1; RUN: opt -licm -basicaa < %s -S | FileCheck %s
2; RUN: opt -aa-pipeline=basic-aa -passes='require<aa>,require<targetir>,require<scalar-evolution>,loop(licm)' < %s -S | FileCheck %s
3
4define void @f_0(i1 %p) nounwind ssp {
5; CHECK-LABEL: @f_0(
6entry:
7  br label %for.body
8
9for.body:
10  br i1 undef, label %if.then, label %for.cond.backedge
11
12for.cond.backedge:
13  br i1 undef, label %for.end104, label %for.body
14
15if.then:
16  br i1 undef, label %if.then27, label %if.end.if.end.split_crit_edge.critedge
17
18if.then27:
19; CHECK: tail call void @llvm.assume
20  tail call void @llvm.assume(i1 %p)
21  br label %for.body61.us
22
23if.end.if.end.split_crit_edge.critedge:
24  br label %for.body61
25
26for.body61.us:
27  br i1 undef, label %for.cond.backedge, label %for.body61.us
28
29for.body61:
30  br i1 undef, label %for.cond.backedge, label %for.body61
31
32for.end104:
33  ret void
34}
35
36define void @f_1(i1 %cond, i32* %ptr) {
37; CHECK-LABEL: @f_1(
38; CHECK: %val = load i32, i32* %ptr
39; CHECK-NEXT:  br label %loop
40
41entry:
42  br label %loop
43
44loop:
45  %x = phi i32 [ 0, %entry ], [ %x.inc, %loop ]
46  call void @llvm.assume(i1 %cond)
47  %val = load i32, i32* %ptr
48  %x.inc = add i32 %x, %val
49  br label %loop
50}
51
52declare void @llvm.assume(i1)
53