OSDN Git Service

[NewGVN] Add unary FNeg support to NewGVN pass
authorCameron McInally <cameron.mcinally@nyu.edu>
Fri, 28 Jun 2019 20:09:32 +0000 (20:09 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Fri, 28 Jun 2019 20:09:32 +0000 (20:09 +0000)
Differential Revision: https://reviews.llvm.org/D63933

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

lib/Transforms/Scalar/NewGVN.cpp
test/Transforms/NewGVN/fpmath.ll

index 99e1819..08ac2b6 100644 (file)
@@ -1991,6 +1991,7 @@ NewGVN::performSymbolicEvaluation(Value *V,
     case Instruction::FCmp:
       E = performSymbolicCmpEvaluation(I);
       break;
+    case Instruction::FNeg:
     case Instruction::Add:
     case Instruction::FAdd:
     case Instruction::Sub:
index 6933ba3..8098bbf 100644 (file)
@@ -43,9 +43,8 @@ define double @test4(double %x, double %y) {
 
 define double @test5(double %x) {
 ; CHECK: @test5(double %x)
-; CHECK: %neg1 = fneg double %x, !fpmath !0
-; CHECK: %neg2 = fneg double %x, !fpmath !1
-; CHECK: %foo = fadd double %neg1, %neg2
+; CHECK: %neg1 = fneg double %x, !fpmath !1
+; CHECK: %foo = fadd double %neg1, %neg1
   %neg1 = fneg double %x, !fpmath !0
   %neg2 = fneg double %x, !fpmath !1
   %foo = fadd double %neg1, %neg2