]> granicus.if.org Git - llvm/commitdiff
Support FNeg in SpeculativeExecution pass
authorCameron McInally <cameron.mcinally@nyu.edu>
Tue, 14 May 2019 16:51:18 +0000 (16:51 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Tue, 14 May 2019 16:51:18 +0000 (16:51 +0000)
Differential Revision: https://reviews.llvm.org/D61910

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360692 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SpeculativeExecution.cpp
test/Transforms/SpeculativeExecution/spec-fp.ll

index 79d2a52b3932560f4eab34bf8c51b03537111112..f9d027eb4a3b9eda288a4dc3bf2a79f471fc979c 100644 (file)
@@ -240,6 +240,7 @@ static unsigned ComputeSpeculationCost(const Instruction *I,
     case Instruction::FMul:
     case Instruction::FDiv:
     case Instruction::FRem:
+    case Instruction::FNeg:
     case Instruction::ICmp:
     case Instruction::FCmp:
       return TTI.getUserCost(I);
index efab8ab704cabd819a065cb44be60db6ee0d883b..181ce3757d48a3c9cb8d2d793e90ab7f28be1102 100644 (file)
@@ -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:
@@ -44,6 +44,20 @@ 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
+}
+
 ; CHECK-LABEL: @ifThen_fmul(
 ; CHECK: fmul
 ; CHECK: br i1 true