1; RUN: opt -indvars -S < %s | FileCheck %s 2 3@b = common global i32 0, align 4 4@c = common global i32 0, align 4 5@a = common global i32 0, align 4 6 7declare void @abort() #1 8 9; Function Attrs: nounwind ssp uwtable 10define i32 @main() { 11entry: 12 %a.promoted13 = load i32, i32* @a, align 4 13 br label %for.cond1.preheader 14 15for.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 ] 18 br label %for.body3 19 20for.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 29 30for.end: ; preds = %for.body3 31 %or.lcssa = phi i32 [ %or, %for.body3 ] 32 br i1 false, label %for.cond1.preheader, label %for.end6 33 34for.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 39 40if.then: ; preds = %for.end6 41 tail call void @abort() #2 42 unreachable 43 44if.end: ; preds = %for.end6 45 ret i32 0 46} 47