aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/IndVarSimplify/crash.ll
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-26 18:28:14 +0000
committerDan Gohman <gohman@apple.com>2010-07-26 18:28:14 +0000
commit6ebfd72f37325a1ebceb53e5ecad524d359d8d0b (patch)
tree93f49fad350bd0cd941bfd685dee06797b698264 /test/Transforms/IndVarSimplify/crash.ll
parent7da5d3fc657bf434a245d11ad91f22feb86296c5 (diff)
downloadexternal_llvm-6ebfd72f37325a1ebceb53e5ecad524d359d8d0b.zip
external_llvm-6ebfd72f37325a1ebceb53e5ecad524d359d8d0b.tar.gz
external_llvm-6ebfd72f37325a1ebceb53e5ecad524d359d8d0b.tar.bz2
Fix SCEVExpander::visitAddRecExpr so that it remembers the induction variable
it inserted rather than using LoopInfo::getCanonicalInductionVariable to rediscover it, since that doesn't work on non-canonical loops. This fixes infinite recurrsion on such loops; PR7562. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109419 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IndVarSimplify/crash.ll')
-rw-r--r--test/Transforms/IndVarSimplify/crash.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/crash.ll b/test/Transforms/IndVarSimplify/crash.ll
index ab43833..516fd80 100644
--- a/test/Transforms/IndVarSimplify/crash.ll
+++ b/test/Transforms/IndVarSimplify/crash.ll
@@ -1,4 +1,5 @@
; RUN: opt -indvars %s -disable-output
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
declare i32 @putchar(i8) nounwind
@@ -17,3 +18,38 @@ define void @t2(i1* %P) nounwind {
; <label>:6 ; preds = %1
ret void
}
+
+; PR7562
+define void @fannkuch() nounwind {
+entry: ; preds = %entry
+ br label %bb12
+
+bb12: ; preds = %bb29, %entry
+ %i.1 = phi i32 [ undef, %entry ], [ %i.0, %bb29 ] ; <i32> [#uses=2]
+ %r.1 = phi i32 [ undef, %entry ], [ %r.0, %bb29 ] ; <i32> [#uses=2]
+ br i1 undef, label %bb13, label %bb24
+
+bb13: ; preds = %bb12
+ br label %bb24
+
+bb24: ; preds = %bb30, %bb13, %bb12
+ %i.2 = phi i32 [ %i.1, %bb13 ], [ %i.0, %bb30 ], [ %i.1, %bb12 ] ; <i32> [#uses=1]
+ %r.0 = phi i32 [ %r.1, %bb13 ], [ %2, %bb30 ], [ %r.1, %bb12 ] ; <i32> [#uses=3]
+ br label %bb28
+
+bb27: ; preds = %bb28
+ %0 = add nsw i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb28
+
+bb28: ; preds = %bb27, %bb26
+ %i.0 = phi i32 [ %i.2, %bb24 ], [ %0, %bb27 ] ; <i32> [#uses=4]
+ %1 = icmp slt i32 %i.0, %r.0 ; <i1> [#uses=1]
+ br i1 %1, label %bb27, label %bb29
+
+bb29: ; preds = %bb28
+ br i1 undef, label %bb12, label %bb30
+
+bb30: ; preds = %bb29
+ %2 = add nsw i32 %r.0, 1 ; <i32> [#uses=1]
+ br label %bb24
+}