summaryrefslogtreecommitdiff
path: root/test/Transforms/IndVarSimplify
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
parent1a988004dba412deb5d6b8e93b955dfc837065f0 (diff)
downloadllvm-4b02915386046fa882a95553a7457ae7d05e9f27.tar.gz
llvm-4b02915386046fa882a95553a7457ae7d05e9f27.tar.bz2
llvm-4b02915386046fa882a95553a7457ae7d05e9f27.tar.xz
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')
-rw-r--r--test/Transforms/IndVarSimplify/no-iv-rewrite.ll24
-rw-r--r--test/Transforms/IndVarSimplify/preserve-signed-wrap.ll10
2 files changed, 30 insertions, 4 deletions
diff --git a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
index f38b54eb0c..639eb1d68d 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
+}
diff --git a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
index 9e46a78ffc..5063b17454 100644
--- a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
+++ b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
@@ -1,7 +1,5 @@
-; RUN: opt < %s -indvars -S > %t
-; RUN: grep sext %t | count 1
-; RUN: grep phi %t | count 1
-; RUN: grep {phi i64} %t
+; RUN: opt < %s -indvars -S | FileCheck %s
+; RUN: opt < %s -indvars -disable-iv-rewrite -S | FileCheck %s
; Indvars should insert a 64-bit induction variable to eliminate the
; sext for the addressing, however it shouldn't eliminate the sext
@@ -15,6 +13,10 @@ entry:
bb.nph: ; preds = %entry
br label %bb
+; CHECK: bb:
+; CHECK: phi i64
+; CHECK: sext i8
+; CHECK-NOT: sext
bb: ; preds = %bb1, %bb.nph
%i.02 = phi i32 [ %5, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=2]
%p.01 = phi i8 [ %4, %bb1 ], [ -1, %bb.nph ] ; <i8> [#uses=2]