[PATCH] D63933: [NewGVN] Add unary FNeg support to NewGVN pass

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 07:48:45 PDT 2019


cameron.mcinally created this revision.
cameron.mcinally added reviewers: spatel, arsenm, andrew.w.kaylor, craig.topper, kpn, dmgreen.
Herald added subscribers: llvm-commits, hiraditya, Prazek, wdng.
Herald added a project: LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D63933

Files:
  llvm/lib/Transforms/Scalar/NewGVN.cpp
  llvm/test/Transforms/NewGVN/fpmath.ll


Index: llvm/test/Transforms/NewGVN/fpmath.ll
===================================================================
--- llvm/test/Transforms/NewGVN/fpmath.ll
+++ llvm/test/Transforms/NewGVN/fpmath.ll
@@ -43,9 +43,8 @@
 
 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
Index: llvm/lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1991,6 +1991,7 @@
     case Instruction::FCmp:
       E = performSymbolicCmpEvaluation(I);
       break;
+    case Instruction::FNeg:
     case Instruction::Add:
     case Instruction::FAdd:
     case Instruction::Sub:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63933.207065.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190628/29624107/attachment.bin>


More information about the llvm-commits mailing list