[PATCH] D87037: [DAGCombiner] Propagate FMF flags in FMA folding

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 19:42:05 PDT 2020


nemanjai added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13156
+
   if (N0CFP && N0CFP->isExactlyValue(1.0))
+    return DAG.getNode(ISD::FADD, SDLoc(N), VT, N1, N2, Flags);
----------------
A couple of things are unclear to me (although not related to this patch):
1. Why do we handle the `0.0` and `1.0` special cases before canonicalization and thereby have to check both ways?
2. Why is the handling for `-1.0` not in the same place?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13194
       AddToWorklist(RHSNeg.getNode());
-      // TODO: The FMA node should have flags that propagate to this node.
-      return DAG.getNode(ISD::FADD, DL, VT, N2, RHSNeg);
+      return DAG.getNode(ISD::FADD, DL, VT, N2, RHSNeg, Flags);
     }
----------------
spatel wrote:
> Add a test (maybe with vector types) for this code path?
+1


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

https://reviews.llvm.org/D87037



More information about the llvm-commits mailing list