[PATCH] D39282: DAG: Fold fma (fneg x), K, y -> fma x, -K, y

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 07:23:45 PDT 2017


RKSimon added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:10128
+    // fma (fneg x), K, y -> fma x -K, y
+    if (N0.getOpcode() == ISD::FNEG) {
+      return DAG.getNode(ISD::FMA, DL, VT, N0.getOperand(0),
----------------
arsenm wrote:
> RKSimon wrote:
> > Do we need a OneUse test on FNEG(N0)?
> I don't think so because this eliminates a use of fneg.
>> Do we need a OneUse test on FNEG(N0)?
> I don't think so because this eliminates a use of fneg.

OK - what about permitting negations of FpImmLegal constants if the negated value is FpImmLegal too?






https://reviews.llvm.org/D39282





More information about the llvm-commits mailing list