aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/IndVarSimplify/variable-stride-ivs.ll
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-16 00:56:15 +0000
committerDan Gohman <gohman@apple.com>2009-02-16 00:56:15 +0000
commit74786c0f4360db7547f8a12980260b5b7a441627 (patch)
treeb6c70648223bc2e9f62a6c4f33748f7c7d05b4da /test/Transforms/IndVarSimplify/variable-stride-ivs.ll
parent926b0a27b9adf79b89042785b8496cced5a49883 (diff)
downloadexternal_llvm-74786c0f4360db7547f8a12980260b5b7a441627.zip
external_llvm-74786c0f4360db7547f8a12980260b5b7a441627.tar.gz
external_llvm-74786c0f4360db7547f8a12980260b5b7a441627.tar.bz2
Rename IndVarsSimplify to IndVarSimplify, to be consistent with
the name used in the code that these tests are for. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IndVarSimplify/variable-stride-ivs.ll')
-rw-r--r--test/Transforms/IndVarSimplify/variable-stride-ivs.ll43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/variable-stride-ivs.ll b/test/Transforms/IndVarSimplify/variable-stride-ivs.ll
new file mode 100644
index 0000000..759ba8e
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/variable-stride-ivs.ll
@@ -0,0 +1,43 @@
+; RUN: llvm-as < %s | opt -indvars -instcombine | llvm-dis | \
+; RUN: grep {store i32 0}
+; Test that -indvars can reduce variable stride IVs. If it can reduce variable
+; stride iv's, it will make %iv. and %m.0.0 isomorphic to each other without
+; cycles, allowing the tmp.21 subtraction to be eliminated.
+; END.
+
+define void @vnum_test8(i32* %data) {
+entry:
+ %tmp.1 = getelementptr i32* %data, i32 3 ; <i32*> [#uses=1]
+ %tmp.2 = load i32* %tmp.1 ; <i32> [#uses=2]
+ %tmp.4 = getelementptr i32* %data, i32 4 ; <i32*> [#uses=1]
+ %tmp.5 = load i32* %tmp.4 ; <i32> [#uses=2]
+ %tmp.8 = getelementptr i32* %data, i32 2 ; <i32*> [#uses=1]
+ %tmp.9 = load i32* %tmp.8 ; <i32> [#uses=3]
+ %tmp.125 = icmp sgt i32 %tmp.2, 0 ; <i1> [#uses=1]
+ br i1 %tmp.125, label %no_exit.preheader, label %return
+
+no_exit.preheader: ; preds = %entry
+ %tmp.16 = getelementptr i32* %data, i32 %tmp.9 ; <i32*> [#uses=1]
+ br label %no_exit
+
+no_exit: ; preds = %no_exit, %no_exit.preheader
+ %iv.ui = phi i32 [ 0, %no_exit.preheader ], [ %iv..inc.ui, %no_exit ] ; <i32> [#uses=1]
+ %iv. = phi i32 [ %tmp.5, %no_exit.preheader ], [ %iv..inc, %no_exit ] ; <i32> [#uses=2]
+ %m.0.0 = phi i32 [ %tmp.5, %no_exit.preheader ], [ %tmp.24, %no_exit ] ; <i32> [#uses=2]
+ store i32 2, i32* %tmp.16
+ %tmp.21 = sub i32 %m.0.0, %iv. ; <i32> [#uses=1]
+ store i32 %tmp.21, i32* %data
+ %tmp.24 = add i32 %m.0.0, %tmp.9 ; <i32> [#uses=1]
+ %iv..inc = add i32 %tmp.9, %iv. ; <i32> [#uses=1]
+ %iv..inc.ui = add i32 %iv.ui, 1 ; <i32> [#uses=2]
+ %iv..inc1 = bitcast i32 %iv..inc.ui to i32 ; <i32> [#uses=1]
+ %tmp.12 = icmp slt i32 %iv..inc1, %tmp.2 ; <i1> [#uses=1]
+ br i1 %tmp.12, label %no_exit, label %return.loopexit
+
+return.loopexit: ; preds = %no_exit
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
+