summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/fpcast.ll
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-11-14 21:21:15 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-11-14 21:21:15 +0000
commit8c3d92e7e50c047cfd74d1f59dc179e871169f01 (patch)
tree266d3bd18bf5bec937234a8f9ca77f030e6ed1a0 /llvm/test/Transforms/InstCombine/fpcast.ll
parent1ff4c0bf0ba21869e4f7a43843fac11b1244ecf2 (diff)
downloadbcm5719-llvm-8c3d92e7e50c047cfd74d1f59dc179e871169f01.tar.gz
bcm5719-llvm-8c3d92e7e50c047cfd74d1f59dc179e871169f01.zip
InstCombine: Fix infinite loop caused by visitFPTrunc
We would attempt to replace a fptrunc of an frem with an identical fptrunc. This would cause the new fptrunc to be added to the worklist. Of course, this results in an infinite loop because we will keep visiting the newly created fptruncs. This fixes PR21576. llvm-svn: 222040
Diffstat (limited to 'llvm/test/Transforms/InstCombine/fpcast.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/fpcast.ll10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fpcast.ll b/llvm/test/Transforms/InstCombine/fpcast.ll
index 9be66fd42c6..c4c8578198b 100644
--- a/llvm/test/Transforms/InstCombine/fpcast.ll
+++ b/llvm/test/Transforms/InstCombine/fpcast.ll
@@ -53,3 +53,13 @@ define half @test5(float %a, float %b, float %c) {
}
declare float @llvm.fabs.f32(float) nounwind readonly
+
+define <1 x float> @test6(<1 x double> %V) {
+ %frem = frem <1 x double> %V, %V
+ %trunc = fptrunc <1 x double> %frem to <1 x float>
+ ret <1 x float> %trunc
+; CHECK-LABEL: @test6
+; CHECK-NEXT: %[[frem:.*]] = frem <1 x double> %V, %V
+; CHECK-NEXT: %[[trunc:.*]] = fptrunc <1 x double> %[[frem]] to <1 x float>
+; CHECK-NEXT: ret <1 x float> %trunc
+}
OpenPOWER on IntegriCloud