summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-06-06 19:02:18 +0000
committerCraig Topper <craig.topper@intel.com>2019-06-06 19:02:18 +0000
commit6cda33ba364208b866252e49a8b5367c28cd2825 (patch)
treec513b2cec8a61c2412e076637a222c2e83d753eb /llvm/test
parent51f85b40bc6ccfce3d6f3c8d984ce6af2336116f (diff)
downloadbcm5719-llvm-6cda33ba364208b866252e49a8b5367c28cd2825.tar.gz
bcm5719-llvm-6cda33ba364208b866252e49a8b5367c28cd2825.zip
[InlineCost] Add support for unary fneg.
This adds support for unary fneg based on the implementation of BinaryOperator without the soft float FP cost. Previously we would just delegate to visitUnaryInstruction. I think the only real change is that we will pass the FastMath flags to SimplifyFNeg now. Differential Revision: https://reviews.llvm.org/D62699 llvm-svn: 362732
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/Inline/inline_constprop.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Inline/inline_constprop.ll b/llvm/test/Transforms/Inline/inline_constprop.ll
index b07ec03d7d6..276c72cd3bd 100644
--- a/llvm/test/Transforms/Inline/inline_constprop.ll
+++ b/llvm/test/Transforms/Inline/inline_constprop.ll
@@ -345,3 +345,34 @@ bb1:
; CHECK-LABEL: define void @caller7(
; CHECK: %call = call i16 @caller7.external(i16 1)
; CHECK-NEXT: ret void
+
+define float @caller8(float %y) {
+; Check that we can constant-prop through fneg instructions
+;
+; CHECK-LABEL: @caller8(
+; CHECK-NOT: call
+; CHECK: ret
+ %x = call float @callee8(float -42.0, float %y)
+ ret float %x
+}
+
+define float @callee8(float %x, float %y) {
+ %neg = fneg float %x
+ %icmp = fcmp ugt float %neg, 42.0
+ br i1 %icmp, label %bb.true, label %bb.false
+
+bb.true:
+ ; This block musn't be counted in the inline cost.
+ %y1 = fadd float %y, 1.0
+ %y2 = fadd float %y1, 1.0
+ %y3 = fadd float %y2, 1.0
+ %y4 = fadd float %y3, 1.0
+ %y5 = fadd float %y4, 1.0
+ %y6 = fadd float %y5, 1.0
+ %y7 = fadd float %y6, 1.0
+ %y8 = fadd float %y7, 1.0
+ ret float %y8
+
+bb.false:
+ ret float %x
+}
OpenPOWER on IntegriCloud