[PATCH] D63896: [GVN] Add support for unary FNeg to GVN pass

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 14:05:22 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL364592: [GVN] Add support for unary FNeg to GVN pass (authored by mcinally, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63896?vs=206924&id=206932#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63896/new/

https://reviews.llvm.org/D63896

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


Index: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp
@@ -492,6 +492,7 @@
   switch (I->getOpcode()) {
     case Instruction::Call:
       return lookupOrAddCall(cast<CallInst>(I));
+    case Instruction::FNeg:
     case Instruction::Add:
     case Instruction::FAdd:
     case Instruction::Sub:
Index: llvm/trunk/test/Transforms/GVN/fpmath.ll
===================================================================
--- llvm/trunk/test/Transforms/GVN/fpmath.ll
+++ llvm/trunk/test/Transforms/GVN/fpmath.ll
@@ -43,9 +43,8 @@
 
 define double @test5(double %x, double %y) {
 ; CHECK: @test5(double %x, double %y)
-; 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63896.206932.patch
Type: text/x-patch
Size: 1089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190627/7e988573/attachment.bin>


More information about the llvm-commits mailing list