summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopStrengthReduce
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-08-14 20:58:31 +0000
committerDevang Patel <dpatel@apple.com>2008-08-14 20:58:31 +0000
commit054a833dd450aaef900e6cf5739b50cded5670fb (patch)
tree59fb75dcc2fc9d01d4927d51beb461957e2307f9 /llvm/test/Transforms/LoopStrengthReduce
parentd09fe9d922e5c019e43e3f969f801f80f446364c (diff)
downloadbcm5719-llvm-054a833dd450aaef900e6cf5739b50cded5670fb.tar.gz
bcm5719-llvm-054a833dd450aaef900e6cf5739b50cded5670fb.zip
If IV is used in a int-to-float cast inside the loop then try to eliminate the cast opeation.
llvm-svn: 54786
Diffstat (limited to 'llvm/test/Transforms/LoopStrengthReduce')
-rw-r--r--llvm/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll b/llvm/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll
new file mode 100644
index 00000000000..681c9be1675
--- /dev/null
+++ b/llvm/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double"
+
+define void @foobar(i32 %n) nounwind {
+entry:
+ icmp eq i32 %n, 0 ; <i1>:0 [#uses=2]
+ br i1 %0, label %return, label %bb.nph
+
+bb.nph: ; preds = %entry
+ %umax = select i1 %0, i32 1, i32 %n ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %bb.nph
+ %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i32> [#uses=3]
+ tail call void @bar( i32 %i.03 ) nounwind
+ uitofp i32 %i.03 to double ; <double>:1 [#uses=1]
+ tail call void @foo( double %1 ) nounwind
+ %indvar.next = add i32 %i.03, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %umax ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %bb
+
+return: ; preds = %bb, %entry
+ ret void
+}
+
+declare void @bar(i32)
+
+declare void @foo(double)
OpenPOWER on IntegriCloud