summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/ScalarEvolution/do-loop.ll18
-rw-r--r--llvm/test/Analysis/ScalarEvolution/smax.ll12
-rw-r--r--llvm/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll4
3 files changed, 32 insertions, 2 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/do-loop.ll b/llvm/test/Analysis/ScalarEvolution/do-loop.ll
new file mode 100644
index 00000000000..c6b3298638b
--- /dev/null
+++ b/llvm/test/Analysis/ScalarEvolution/do-loop.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep smax
+; PR1614
+
+define i32 @f(i32 %x, i32 %y) {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; <i32> [#uses=2]
+ %x_addr.0 = add i32 %indvar, %x ; <i32> [#uses=1]
+ %tmp2 = add i32 %x_addr.0, 1 ; <i32> [#uses=2]
+ %tmp5 = icmp slt i32 %tmp2, %y ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br i1 %tmp5, label %bb, label %bb7
+
+bb7: ; preds = %bb
+ ret i32 %tmp2
+}
diff --git a/llvm/test/Analysis/ScalarEvolution/smax.ll b/llvm/test/Analysis/ScalarEvolution/smax.ll
new file mode 100644
index 00000000000..157d54f3e63
--- /dev/null
+++ b/llvm/test/Analysis/ScalarEvolution/smax.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep smax | count 2
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep \
+; RUN: "%. smax %. smax %."
+; PR1614
+
+define i32 @x(i32 %a, i32 %b, i32 %c) {
+ %A = icmp sgt i32 %a, %b
+ %B = select i1 %A, i32 %a, i32 %b
+ %C = icmp sle i32 %c, %B
+ %D = select i1 %C, i32 %B, i32 %c
+ ret i32 %D
+}
diff --git a/llvm/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll b/llvm/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll
index c7426918462..635950aed66 100644
--- a/llvm/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll
+++ b/llvm/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | grep select
-; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | opt \
+; RUN: -analyze -loops | not grep "^Loop Containing"
; PR1179
define i32 @ltst(i32 %x) {
OpenPOWER on IntegriCloud