summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-05-30 23:55:12 +0000
committerSanjay Patel <spatel@rotateright.com>2018-05-30 23:55:12 +0000
commitceb595b04e88f6d0da922a9631bb3edf715480fc (patch)
tree5529c7d36094c2579f68edc40334e324696cad7e /llvm/test/Transforms
parent61763b65af94107b75ec5be8797b7a845c626930 (diff)
downloadbcm5719-llvm-ceb595b04e88f6d0da922a9631bb3edf715480fc.tar.gz
bcm5719-llvm-ceb595b04e88f6d0da922a9631bb3edf715480fc.zip
[InstCombine] don't negate constant expression with fsub (PR37605)
X + (-C) would be transformed back into X - C, so infinite loop: https://bugs.llvm.org/show_bug.cgi?id=37605 llvm-svn: 333610
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/fsub.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fsub.ll b/llvm/test/Transforms/InstCombine/fsub.ll
index 9ce73084f79..22295490cc6 100644
--- a/llvm/test/Transforms/InstCombine/fsub.ll
+++ b/llvm/test/Transforms/InstCombine/fsub.ll
@@ -242,3 +242,17 @@ define float @neg_trunc_op1_extra_uses(double %a, float %b) {
ret float %t3
}
+; Don't negate a constant expression to form fadd and induce infinite looping:
+; https://bugs.llvm.org/show_bug.cgi?id=37605
+
+@b = external global i16, align 1
+
+define float @PR37605(float %conv) {
+; CHECK-LABEL: @PR37605(
+; CHECK-NEXT: [[SUB:%.*]] = fsub float [[CONV:%.*]], bitcast (i32 ptrtoint (i16* @b to i32) to float)
+; CHECK-NEXT: ret float [[SUB]]
+;
+ %sub = fsub float %conv, bitcast (i32 ptrtoint (i16* @b to i32) to float)
+ ret float %sub
+}
+
OpenPOWER on IntegriCloud