1 ; RUN: opt -indvars -S < %s | FileCheck %s
3 @b = common global i32 0, align 4
4 @c = common global i32 0, align 4
5 @a = common global i32 0, align 4
7 declare void @abort() #1
9 ; Function Attrs: nounwind ssp uwtable
12 %a.promoted13 = load i32, i32* @a, align 4
13 br label %for.cond1.preheader
15 for.cond1.preheader: ; preds = %entry, %for.end
16 %or.lcssa14 = phi i32 [ %a.promoted13, %entry ], [ %or.lcssa, %for.end ]
17 %d.010 = phi i32 [ 1, %entry ], [ 0, %for.end ]
20 for.body3: ; preds = %for.cond1.preheader, %for.body3
21 %inc12 = phi i32 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
22 %or11 = phi i32 [ %or.lcssa14, %for.cond1.preheader ], [ %or, %for.body3 ]
23 ; CHECK-NOT: sub nuw i32 %inc12, %d.010
24 ; CHECK: sub i32 %inc12, %d.010
25 %add = sub i32 %inc12, %d.010
26 %or = or i32 %or11, %add
27 %inc = add i32 %inc12, 1
28 br i1 false, label %for.body3, label %for.end
30 for.end: ; preds = %for.body3
31 %or.lcssa = phi i32 [ %or, %for.body3 ]
32 br i1 false, label %for.cond1.preheader, label %for.end6
34 for.end6: ; preds = %for.end
35 %or.lcssa.lcssa = phi i32 [ %or.lcssa, %for.end ]
36 store i32 %or.lcssa.lcssa, i32* @a, align 4
37 %cmp7 = icmp eq i32 %or.lcssa.lcssa, -1
38 br i1 %cmp7, label %if.end, label %if.then
40 if.then: ; preds = %for.end6
41 tail call void @abort() #2
44 if.end: ; preds = %for.end6