blob: 06a7d5ebe4dc1206b7585d64a90cf5d3d88283bb [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +00001; RUN: opt -S -indvars < %s | FileCheck %s
2target datalayout = "E-m:e-i64:64-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5; Function Attrs: nounwind
6define void @foo(i32* nocapture %a, i32* nocapture readonly %b, i32 signext %n) #0 {
7entry:
8
9; CHECK-LABEL: @foo
10
11 %cmp.10 = icmp sgt i32 %n, 0
12 br i1 %cmp.10, label %for.body.lr.ph, label %for.cond.cleanup
13
14for.body.lr.ph: ; preds = %entry
15 br label %for.body
16
17for.cond.for.cond.cleanup_crit_edge: ; preds = %for.inc
18 br label %for.cond.cleanup
19
20for.cond.cleanup: ; preds = %for.cond.for.cond.cleanup_crit_edge, %entry
21 ret void
22
23for.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
27
28; CHECK-NOT: br i1 %cmp1, label %if.then, label %for.inc
29; CHECK: br i1 false, label %if.then, label %for.inc
30
31if.then: ; preds = %for.body
32 %idxprom = sext i32 %i.011 to i64
33 %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
34 %0 = load i32, i32* %arrayidx, align 4
35 %add = add nsw i32 %0, 1
36 %arrayidx3 = getelementptr inbounds i32, i32* %a, i64 %idxprom
37 store i32 %add, i32* %arrayidx3, align 4
38 br label %for.inc
39
40for.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
44}
45
46attributes #0 = { nounwind }
47