aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-06-30 01:27:23 +0000
committerAndrew Trick <atrick@apple.com>2011-06-30 01:27:23 +0000
commit60ac719c85366da04852c204aea5aa86d66dbb07 (patch)
treec892ee506bb9802deeded96450755412b919af12 /test
parent5244c4cc2fd31e49bae2b192bd824a94b6ad5331 (diff)
indvars -disable-iv-rewrite: handle an edge case involving identity phis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134124 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/IndVarSimplify/no-iv-rewrite.ll39
1 files changed, 32 insertions, 7 deletions
diff --git a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
index 3395be2836..01871707a3 100644
--- a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
+++ b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
@@ -23,7 +23,7 @@ ph:
; sext should be eliminated while preserving gep inboundsness.
; CHECK-NOT: sext
; CHECK: getelementptr inbounds
-; CHECK: exit
+; CHECK: exit:
loop:
%i.02 = phi i32 [ 0, %ph ], [ %iinc, %loop ]
%s.01 = phi i32 [ 0, %ph ], [ %sinc, %loop ]
@@ -64,7 +64,7 @@ ph:
; CHECK: getelementptr inbounds
; %vall sext should obviously not be eliminated
; CHECK: sext
-; CHECK: exit
+; CHECK: exit:
loop:
%i.02 = phi i32 [ 0, %ph ], [ %iinc, %loop ]
%s.01 = phi i64 [ 0, %ph ], [ %sinc, %loop ]
@@ -108,7 +108,7 @@ ph:
; Preserve gep inboundsness, and don't factor it.
; CHECK: getelementptr inbounds i32* %ptriv, i32 1
; CHECK-NOT: add
-; CHECK: exit
+; CHECK: exit:
loop:
%ptriv = phi i32* [ %first, %ph ], [ %ptrpost, %loop ]
%ofs = sext i32 %idx to i64
@@ -139,7 +139,7 @@ entry:
; CHECK: phi i32
; CHECK: bitcast
; CHECK: getelementptr
-; CHECK: exit
+; CHECK: exit:
loop:
%iv = phi i32 [%start, %entry], [%next, %loop]
%p = phi %struct* [%base, %entry], [%pinc, %loop]
@@ -157,12 +157,13 @@ exit:
}
define void @maxvisitor(i32 %limit, i32* %base) nounwind {
-entry: br label %loop
+entry:
+ br label %loop
; CHECK: loop:
; CHECK: phi i64
; CHECK: trunc
-; CHECK: exit
+; CHECK: exit:
loop:
%idx = phi i32 [ 0, %entry ], [ %idx.next, %loop.inc ]
%max = phi i32 [ 0, %entry ], [ %max.next, %loop.inc ]
@@ -186,4 +187,28 @@ loop.inc:
exit:
ret void
-} \ No newline at end of file
+}
+
+; CHECK: loop:
+; CHECK: phi i32
+; CHECK-NOT: phi
+; CHECK: exit:
+define void @identityphi(i32 %limit) nounwind {
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i32 [ 0, %entry], [ %iv.next, %control ]
+ br i1 undef, label %if.then, label %control
+
+if.then:
+ br label %control
+
+control:
+ %iv.next = phi i32 [ %iv, %loop ], [ undef, %if.then ]
+ %cmp = icmp slt i32 %iv.next, %limit
+ br i1 %cmp, label %loop, label %exit
+
+exit:
+ ret void
+}