1 ; RUN: opt -S -passes=indvars < %s | FileCheck %s
2 target datalayout = "E-m:e-i64:64-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
5 ; Function Attrs: nounwind
6 define void @foo(ptr nocapture %a, ptr nocapture readonly %b, i32 signext %n) #0 {
11 %cmp.10 = icmp sgt i32 %n, 0
12 br i1 %cmp.10, label %for.body.lr.ph, label %for.cond.cleanup
14 for.body.lr.ph: ; preds = %entry
17 for.cond.for.cond.cleanup_crit_edge: ; preds = %for.inc
18 br label %for.cond.cleanup
20 for.cond.cleanup: ; preds = %for.cond.for.cond.cleanup_crit_edge, %entry
23 for.body: ; preds = %for.body.lr.ph, %for.inc
24 %i.011 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
25 %cmp1 = icmp sgt i32 %i.011, %n
26 br i1 %cmp1, label %if.then, label %for.inc
28 ; CHECK-NOT: br i1 %cmp1, label %if.then, label %for.inc
29 ; CHECK: br i1 false, label %if.then, label %for.inc
31 if.then: ; preds = %for.body
32 %idxprom = sext i32 %i.011 to i64
33 %arrayidx = getelementptr inbounds i32, ptr %b, i64 %idxprom
34 %0 = load i32, ptr %arrayidx, align 4
35 %add = add nsw i32 %0, 1
36 %arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom
37 store i32 %add, ptr %arrayidx3, align 4
40 for.inc: ; preds = %for.body, %if.then
41 %inc = add nsw i32 %i.011, 1
42 %cmp = icmp slt i32 %inc, %n
43 br i1 %cmp, label %for.body, label %for.cond.for.cond.cleanup_crit_edge
46 attributes #0 = { nounwind }