aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2010-02-10 11:10:31 -0800
committerShih-wei Liao <sliao@google.com>2010-02-10 11:10:31 -0800
commite264f62ca09a8f65c87a46d562a4d0f9ec5d457e (patch)
tree59e3d57ef656cef79afa708ae0a3daf25cd91fcf /test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll
downloadexternal_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.zip
external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.gz
external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.bz2
Check in LLVM r95781.
Diffstat (limited to 'test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll')
-rw-r--r--test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll b/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll
new file mode 100644
index 0000000..75bd634
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll
@@ -0,0 +1,28 @@
+; RUN: opt < %s -analyze -scalar-evolution \
+; RUN: -scalar-evolution-max-iterations=0 | FileCheck %s
+; PR2607
+
+define i32 @_Z1aj(i32 %j) nounwind {
+entry:
+ icmp sgt i32 0, %j ; <i1>:0 [#uses=1]
+ br i1 %0, label %bb.preheader, label %return
+
+bb.preheader: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb, %bb.preheader
+ %i.01 = phi i32 [ %1, %bb ], [ 0, %bb.preheader ] ; <i32> [#uses=1]
+ add i32 %i.01, -1 ; <i32>:1 [#uses=3]
+ icmp sgt i32 %1, %j ; <i1>:2 [#uses=1]
+ br i1 %2, label %bb, label %return.loopexit
+
+return.loopexit: ; preds = %bb
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ %i.0.lcssa = phi i32 [ 0, %entry ], [ %1, %return.loopexit ] ; <i32> [#uses=1]
+ ret i32 %i.0.lcssa
+}
+
+; CHECK: backedge-taken count is (-1 + (-1 * %j))
+