[PATCH] D90901: [DAGCombiner] Don't fold ((fma (fneg X), Y, (fneg Z)) to fneg (fma X, Y, Z))

Jim Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 22:30:02 PST 2020


Jim created this revision.
Jim added reviewers: steven.zhang, RKSimon.
Herald added subscribers: llvm-commits, ecnelises, hiraditya.
Herald added a project: LLVM.
Jim requested review of this revision.

In the special case, X = -1,  Y = 0 and Z = 0 that (-(-1))*0+(-0)=0 is not equal to -(-1*0+0)=-0.
So it is a incorrect transform.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90901

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -13374,12 +13374,6 @@
     }
   }
 
-  // fold ((fma (fneg X), Y, (fneg Z)) -> fneg (fma X, Y, Z))
-  // fold ((fma X, (fneg Y), (fneg Z)) -> fneg (fma X, Y, Z))
-  if (!TLI.isFNegFree(VT))
-    if (SDValue Neg = TLI.getCheaperNegatedExpression(
-            SDValue(N, 0), DAG, LegalOperations, ForCodeSize))
-      return DAG.getNode(ISD::FNEG, DL, VT, Neg);
   return SDValue();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90901.303331.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201106/322261bb/attachment.bin>


More information about the llvm-commits mailing list