aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-24 03:09:42 +0000
committerDan Gohman <gohman@apple.com>2010-04-24 03:09:42 +0000
commit9f93d30a26ae9928f886ef7271efeafcea2a00a6 (patch)
tree2174133ce20c35c5d2672148a050586b9109ad43 /test/Analysis
parentd19bba69ad92311c64c8d55d69c74543933e451e (diff)
ScalarEvolution support for <= and >= loops.
Also, generalize ScalarEvolutions's min and max recognition to handle some new forms of min and max that this change makes more common. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll1
-rw-r--r--test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll1
-rw-r--r--test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll6
-rw-r--r--test/Analysis/ScalarEvolution/sle.ll27
4 files changed, 31 insertions, 4 deletions
diff --git a/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll b/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll
index 06637b5eae..335bbaf9ad 100644
--- a/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll
+++ b/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll
@@ -1,6 +1,5 @@
; RUN: opt < %s -analyze -scalar-evolution |& \
; RUN: grep {Loop %bb: backedge-taken count is (7 + (-1 \\* %argc))}
-; XFAIL: *
define i32 @main(i32 %argc, i8** %argv) nounwind {
entry:
diff --git a/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll b/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
index 226221b297..25a0434b29 100644
--- a/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
+++ b/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
@@ -1,5 +1,4 @@
; RUN: opt < %s -analyze -scalar-evolution | grep {backedge-taken count is 255}
-; XFAIL: *
define i32 @foo(i32 %x, i32 %y, i32* %lam, i32* %alp) nounwind {
bb1.thread:
diff --git a/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll b/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll
index 33a74795d2..12254e37dc 100644
--- a/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll
+++ b/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll
@@ -1,5 +1,7 @@
-; RUN: opt < %s -analyze -scalar-evolution | grep {0 smax}
-; XFAIL: *
+; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+
+; CHECK: @f
+; CHECK: Loop %bb16.preheader: backedge-taken count is (-1 + %c.idx.val)
define i32 @f(i32 %c.idx.val) {
diff --git a/test/Analysis/ScalarEvolution/sle.ll b/test/Analysis/ScalarEvolution/sle.ll
new file mode 100644
index 0000000000..f38f6b63dc
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/sle.ll
@@ -0,0 +1,27 @@
+; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
+
+; ScalarEvolution should be able to use nsw information to prove that
+; this loop has a finite trip count.
+
+; CHECK: @le
+; CHECK: Loop %for.body: backedge-taken count is %n
+; CHECK: Loop %for.body: max backedge-taken count is 9223372036854775807
+
+define void @le(i64 %n, double* nocapture %p) nounwind {
+entry:
+ %cmp6 = icmp slt i64 %n, 0 ; <i1> [#uses=1]
+ br i1 %cmp6, label %for.end, label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] ; <i64> [#uses=2]
+ %arrayidx = getelementptr double* %p, i64 %i ; <double*> [#uses=2]
+ %t4 = load double* %arrayidx ; <double> [#uses=1]
+ %mul = fmul double %t4, 2.200000e+00 ; <double> [#uses=1]
+ store double %mul, double* %arrayidx
+ %i.next = add nsw i64 %i, 1 ; <i64> [#uses=2]
+ %cmp = icmp sgt i64 %i.next, %n ; <i1> [#uses=1]
+ br i1 %cmp, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}