[PATCH] D75982: [DAGCombine] Respect the uses when combine FMA for a*b+/-c*d

qshanz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 03:46:56 PDT 2020


steven.zhang marked an inline comment as done.
steven.zhang added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:11923
+  // prefer to fold the multiply with fewer uses.
+  if (Aggressive && isContractableFMUL(N0) && isContractableFMUL(N1) &&
+      (N0.getNode()->use_size() > N1.getNode()->use_size())) {
----------------
lebedev.ri wrote:
> steven.zhang wrote:
> > lebedev.ri wrote:
> > > I'm not sure why `Aggressive && isContractableFMUL(N0) && isContractableFMUL(N1)` check is here?
> > > That is already checked in the lambdas.
> > Only when both operands(LHS/RHS) are FMUL we should respect the uses to decide on folding which one,  Therefore, we need the check here. 
> Err, i mean, why `Aggressive` check is there?
Ah, just to safe the compiling time for those two isContractableFMUL. But seems that it is cheap as it only check some flags. I will remove the Aggressive check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75982





More information about the llvm-commits mailing list