1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -indvars -S < %s | FileCheck %s
4 @b = common global i32 0, align 4
5 @c = common global i32 0, align 4
6 @a = common global i32 0, align 4
8 declare void @abort() #1
10 ; Function Attrs: nounwind ssp uwtable
14 ; CHECK-NEXT: br label [[FOR_COND1_PREHEADER:%.*]]
15 ; CHECK: for.cond1.preheader:
16 ; CHECK-NEXT: br label [[FOR_BODY3:%.*]]
18 ; CHECK-NEXT: br i1 false, label [[FOR_BODY3]], label [[FOR_END:%.*]]
20 ; CHECK-NEXT: br i1 false, label [[FOR_COND1_PREHEADER]], label [[FOR_END6:%.*]]
22 ; CHECK-NEXT: [[OR_LCSSA_LCSSA:%.*]] = phi i32 [ -1, [[FOR_END]] ]
23 ; CHECK-NEXT: store i32 [[OR_LCSSA_LCSSA]], i32* @a, align 4
24 ; CHECK-NEXT: [[CMP7:%.*]] = icmp eq i32 [[OR_LCSSA_LCSSA]], -1
25 ; CHECK-NEXT: br i1 [[CMP7]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
27 ; CHECK-NEXT: tail call void @abort()
28 ; CHECK-NEXT: unreachable
30 ; CHECK-NEXT: ret i32 0
33 %a.promoted13 = load i32, i32* @a, align 4
34 br label %for.cond1.preheader
36 for.cond1.preheader: ; preds = %entry, %for.end
37 %or.lcssa14 = phi i32 [ %a.promoted13, %entry ], [ %or.lcssa, %for.end ]
38 %d.010 = phi i32 [ 1, %entry ], [ 0, %for.end ]
41 for.body3: ; preds = %for.cond1.preheader, %for.body3
42 %inc12 = phi i32 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
43 %or11 = phi i32 [ %or.lcssa14, %for.cond1.preheader ], [ %or, %for.body3 ]
44 %add = sub i32 %inc12, %d.010
45 %or = or i32 %or11, %add
46 %inc = add i32 %inc12, 1
47 br i1 false, label %for.body3, label %for.end
49 for.end: ; preds = %for.body3
50 %or.lcssa = phi i32 [ %or, %for.body3 ]
51 br i1 false, label %for.cond1.preheader, label %for.end6
53 for.end6: ; preds = %for.end
54 %or.lcssa.lcssa = phi i32 [ %or.lcssa, %for.end ]
55 store i32 %or.lcssa.lcssa, i32* @a, align 4
56 %cmp7 = icmp eq i32 %or.lcssa.lcssa, -1
57 br i1 %cmp7, label %if.end, label %if.then
59 if.then: ; preds = %for.end6
60 tail call void @abort() #2
63 if.end: ; preds = %for.end6