aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/IndVarSimplify/preserve-signed-wrap.ll3
-rw-r--r--test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll7
-rw-r--r--test/Transforms/IndVarSimplify/signed-trip-count.ll31
3 files changed, 37 insertions, 4 deletions
diff --git a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
index 0a91ec8..930721a 100644
--- a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
+++ b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
@@ -1,5 +1,6 @@
; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
-; RUN: grep sext %t | count 1
+; RUN: grep sext %t | count 2
+; RUN: grep { = sext i32 %n to i64} %t
; RUN: grep phi %t | count 1
; RUN: grep {phi i64} %t
diff --git a/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll b/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
index 08b08f2..9588bd3 100644
--- a/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
+++ b/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
@@ -1,6 +1,7 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | not grep sext
-
-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"
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: grep sext %t | count 2
+; RUN: grep { = sext i16 %N to i64} %t
+; RUN: grep { = sext i32 %count to i64} %t
define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly {
entry:
diff --git a/test/Transforms/IndVarSimplify/signed-trip-count.ll b/test/Transforms/IndVarSimplify/signed-trip-count.ll
new file mode 100644
index 0000000..cea9f82
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/signed-trip-count.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: grep { = sext i32 %n} %t
+; RUN: grep phi %t | count 1
+; RUN: not grep zext %t
+
+define void @foo(i64* nocapture %x, i32 %n) nounwind {
+entry:
+ %tmp102 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
+ br i1 %tmp102, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb7, %bb.nph
+ %i.01 = phi i32 [ %tmp6, %bb7 ], [ 0, %bb.nph ] ; <i32> [#uses=3]
+ %tmp1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
+ %tmp4 = getelementptr i64* %x, i32 %i.01 ; <i64*> [#uses=1]
+ store i64 %tmp1, i64* %tmp4, align 8
+ %tmp6 = add i32 %i.01, 1 ; <i32> [#uses=2]
+ br label %bb7
+
+bb7: ; preds = %bb
+ %tmp10 = icmp slt i32 %tmp6, %n ; <i1> [#uses=1]
+ br i1 %tmp10, label %bb, label %bb7.return_crit_edge
+
+bb7.return_crit_edge: ; preds = %bb7
+ br label %return
+
+return: ; preds = %bb7.return_crit_edge, %entry
+ ret void
+}