summaryrefslogtreecommitdiff
path: root/test/Transforms/LoopStrengthReduce/dont_reverse.ll
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-05-20 00:34:08 +0000
committerDan Gohman <gohman@apple.com>2009-05-20 00:34:08 +0000
commit513fae2db51c7d22ec1253e89939d27732b21a5e (patch)
tree25cd0e30047437ef0512bc27f93bdb32e9ab2816 /test/Transforms/LoopStrengthReduce/dont_reverse.ll
parent81e4e9f7cb8bff4f164c415c062a216774445c47 (diff)
downloadllvm-513fae2db51c7d22ec1253e89939d27732b21a5e.tar.gz
llvm-513fae2db51c7d22ec1253e89939d27732b21a5e.tar.bz2
llvm-513fae2db51c7d22ec1253e89939d27732b21a5e.tar.xz
Suppress the IV reversal transformation in the case that the RHS
of the comparison is defined inside the loop. This fixes a use-before-def problem, because the transformation puts a use of the RHS outside the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopStrengthReduce/dont_reverse.ll')
-rw-r--r--test/Transforms/LoopStrengthReduce/dont_reverse.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Transforms/LoopStrengthReduce/dont_reverse.ll b/test/Transforms/LoopStrengthReduce/dont_reverse.ll
new file mode 100644
index 0000000000..39eca6c963
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/dont_reverse.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis \
+; RUN: | grep {icmp eq i2 %lsr.iv.next, %xmp4344}
+
+; Don't reverse the iteration if the rhs of the compare is defined
+; inside the loop.
+
+define void @Fill_Buffer() nounwind {
+entry:
+ br label %bb8
+
+bb8:
+ %indvar34 = phi i32 [ 0, %entry ], [ %indvar.next35, %bb8 ]
+ %indvar3451 = trunc i32 %indvar34 to i2
+ %xmp4344 = xor i2 0, -1
+ %xmp104 = icmp eq i2 %indvar3451, %xmp4344
+ %indvar.next35 = add i32 %indvar34, 1
+ br i1 %xmp104, label %bb10, label %bb8
+
+bb10:
+ unreachable
+}