summaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-05 19:47:39 +0000
committerChris Lattner <sabre@nondot.org>2005-08-05 19:47:39 +0000
commit0ef10c935a8915afab1ba57dc1b6cd67208e15f4 (patch)
treeed4793cbed422b0c4a20e29b4b80f8772ca10fc3 /test/Transforms
parent6281ae4bf0d99650c42bda934a44f316db9c6707 (diff)
downloadexternal_llvm-0ef10c935a8915afab1ba57dc1b6cd67208e15f4.zip
external_llvm-0ef10c935a8915afab1ba57dc1b6cd67208e15f4.tar.gz
external_llvm-0ef10c935a8915afab1ba57dc1b6cd67208e15f4.tar.bz2
two simple testcases loopreduce should handle but does not yet currently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll21
-rw-r--r--test/Transforms/LoopStrengthReduce/related_indvars.ll29
2 files changed, 50 insertions, 0 deletions
diff --git a/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll b/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll
new file mode 100644
index 0000000..f60e7d6
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll
@@ -0,0 +1,21 @@
+; Make sure that the compare instruction occurs after the increment to avoid
+; having overlapping live ranges that result in copies. We want the setcc instruction
+; immediately before the conditional branch.
+;
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | %prcontext 'br bool' 1 | grep set
+; XFAIL: *
+
+void %foo(float* %D, uint %E) {
+entry:
+ br label %no_exit
+
+no_exit:
+ %indvar = phi uint [ 0, %entry ], [ %indvar.next, %no_exit ]
+ volatile store float 0.0, float* %D
+ %indvar.next = add uint %indvar, 1 ; <uint> [#uses=2]
+ %exitcond = seteq uint %indvar.next, %E ; <bool> [#uses=1]
+ br bool %exitcond, label %loopexit, label %no_exit
+
+loopexit:
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/related_indvars.ll b/test/Transforms/LoopStrengthReduce/related_indvars.ll
new file mode 100644
index 0000000..e331716
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/related_indvars.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | wc -l | grep 1
+
+; This should only result in one PHI node!
+; XFAIL: *
+
+; void foo(double *D, double *E, double F) {
+; while (D != E)
+; *D++ = F;
+; }
+
+void %foo(double* %D, double* %E, double %F) {
+entry:
+ %tmp.24 = seteq double* %D, %E ; <bool> [#uses=1]
+ br bool %tmp.24, label %return, label %no_exit
+
+no_exit: ; preds = %no_exit, %entry
+ %indvar = phi uint [ 0, %entry ], [ %indvar.next, %no_exit ] ; <uint> [#uses=3]
+ %D_addr.0.0.rec = cast uint %indvar to int ; <int> [#uses=1]
+ %D_addr.0.0 = getelementptr double* %D, uint %indvar ; <double*> [#uses=1]
+ %inc.rec = add int %D_addr.0.0.rec, 1 ; <int> [#uses=1]
+ %inc = getelementptr double* %D, int %inc.rec ; <double*> [#uses=1]
+ store double %F, double* %D_addr.0.0
+ %tmp.2 = seteq double* %inc, %E ; <bool> [#uses=1]
+ %indvar.next = add uint %indvar, 1 ; <uint> [#uses=1]
+ br bool %tmp.2, label %return, label %no_exit
+
+return: ; preds = %no_exit, %entry
+ ret void
+}