[llvm] r360692 - Support FNeg in SpeculativeExecution pass

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 09:51:18 PDT 2019


Author: mcinally
Date: Tue May 14 09:51:18 2019
New Revision: 360692

URL: http://llvm.org/viewvc/llvm-project?rev=360692&view=rev
Log:
Support FNeg in SpeculativeExecution pass

Differential Revision: https://reviews.llvm.org/D61910

Modified:
    llvm/trunk/lib/Transforms/Scalar/SpeculativeExecution.cpp
    llvm/trunk/test/Transforms/SpeculativeExecution/spec-fp.ll

Modified: llvm/trunk/lib/Transforms/Scalar/SpeculativeExecution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SpeculativeExecution.cpp?rev=360692&r1=360691&r2=360692&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SpeculativeExecution.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SpeculativeExecution.cpp Tue May 14 09:51:18 2019
@@ -240,6 +240,7 @@ static unsigned ComputeSpeculationCost(c
     case Instruction::FMul:
     case Instruction::FDiv:
     case Instruction::FRem:
+    case Instruction::FNeg:
     case Instruction::ICmp:
     case Instruction::FCmp:
       return TTI.getUserCost(I);

Modified: llvm/trunk/test/Transforms/SpeculativeExecution/spec-fp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SpeculativeExecution/spec-fp.ll?rev=360692&r1=360691&r2=360692&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SpeculativeExecution/spec-fp.ll (original)
+++ llvm/trunk/test/Transforms/SpeculativeExecution/spec-fp.ll Tue May 14 09:51:18 2019
@@ -30,10 +30,10 @@ b:
   ret void
 }
 
-; CHECK-LABEL: @ifThen_fneg(
+; CHECK-LABEL: @ifThen_binary_fneg(
 ; CHECK: fsub float -0.0
 ; CHECK: br i1 true
-define void @ifThen_fneg() {
+define void @ifThen_binary_fneg() {
   br i1 true, label %a, label %b
 
 a:
@@ -41,6 +41,20 @@ a:
   br label %b
 
 b:
+  ret void
+}
+
+; CHECK-LABEL: @ifThen_unary_fneg(
+; CHECK: fneg float
+; CHECK: br i1 true
+define void @ifThen_unary_fneg() {
+  br i1 true, label %a, label %b
+
+a:
+  %x = fneg float undef
+  br label %b
+
+b:
   ret void
 }
 




More information about the llvm-commits mailing list