aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis/ScalarEvolution
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-02-20 06:48:22 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-02-20 06:48:22 +0000
commit3e6307698084e7adfc10b739442ae29742beefd0 (patch)
treeebc561431001a1c949d932f9f8224b4ed7391ee9 /test/Analysis/ScalarEvolution
parent19fc1d3742ccba2d8dde5d69c5593e1a0b83fefa (diff)
downloadexternal_llvm-3e6307698084e7adfc10b739442ae29742beefd0.zip
external_llvm-3e6307698084e7adfc10b739442ae29742beefd0.tar.gz
external_llvm-3e6307698084e7adfc10b739442ae29742beefd0.tar.bz2
Add 'umax' similar to 'smax' SCEV. Closes PR2003.
Parse reversed smax and umax as smin and umin and express them with negative or binary-not SCEVs (which are really just subtract under the hood). Parse 'xor %x, -1' as (-1 - %x). Remove dead code (ConstantInt::get always returns a ConstantInt). Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets passed into a uint64_t. Instead, create the -1 directly from ConstantInt::getAllOnesValue(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/ScalarEvolution')
-rw-r--r--test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll2
-rw-r--r--test/Analysis/ScalarEvolution/2008-02-15-UMax.ll17
2 files changed, 18 insertions, 1 deletions
diff --git a/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll b/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
index e725852..23ffc65 100644
--- a/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
+++ b/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb: ( -1 + ( -1 \\* %x) + %y) iterations!}
+; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb: ( -1 + ( -1 \\* %x) + (( 1 + %x) umax %y)) iterations!}
; PR1597
define i32 @f(i32 %x, i32 %y) {
diff --git a/test/Analysis/ScalarEvolution/2008-02-15-UMax.ll b/test/Analysis/ScalarEvolution/2008-02-15-UMax.ll
new file mode 100644
index 0000000..0f977f8
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/2008-02-15-UMax.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep umax
+; PR2003
+
+define i32 @foo(i32 %n) {
+entry:
+ br label %header
+header:
+ %i = phi i32 [ 100, %entry ], [ %i.inc, %next ]
+ %cond = icmp ult i32 %i, %n
+ br i1 %cond, label %next, label %return
+next:
+ %i.inc = add i32 %i, 1
+ br label %header
+return:
+ ret i32 %i
+}
+