summaryrefslogtreecommitdiffstats
path: root/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-07-02 02:34:25 +0000
committerAndrew Trick <atrick@apple.com>2011-07-02 02:34:25 +0000
commit4b02915386046fa882a95553a7457ae7d05e9f27 (patch)
treed5a5ef771b24bb79f71275c40b9d5b51f98652c5 /test/Transforms/IndVarSimplify/no-iv-rewrite.ll
parent1a988004dba412deb5d6b8e93b955dfc837065f0 (diff)
downloadexternal_llvm-4b02915386046fa882a95553a7457ae7d05e9f27.zip
external_llvm-4b02915386046fa882a95553a7457ae7d05e9f27.tar.gz
external_llvm-4b02915386046fa882a95553a7457ae7d05e9f27.tar.bz2
indvars -disable-iv-rewrite: bug fix involving weird geps and related cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134306 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IndVarSimplify/no-iv-rewrite.ll')
-rw-r--r--test/Transforms/IndVarSimplify/no-iv-rewrite.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
index f38b54e..639eb1d 100644
--- a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
+++ b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
@@ -246,3 +246,27 @@ exit:
%result = and i64 %val, %t3
ret i64 %result
}
+
+; The i induction variable looks like a wrap-around, but it really is just
+; a simple affine IV. Make sure that indvars simplifies through.
+define i32 @indirectRecurrence() nounwind {
+entry:
+ br label %loop
+
+; ReplaceLoopExitValue should fold the return value to constant 9.
+; CHECK: loop:
+; CHECK: phi i32
+; CHECK: ret i32 9
+loop:
+ %j.0 = phi i32 [ 1, %entry ], [ %j.next, %cond_true ]
+ %i.0 = phi i32 [ 0, %entry ], [ %j.0, %cond_true ]
+ %tmp = icmp ne i32 %j.0, 10
+ br i1 %tmp, label %cond_true, label %return
+
+cond_true:
+ %j.next = add i32 %j.0, 1
+ br label %loop
+
+return:
+ ret i32 %i.0
+}