[PATCH] D122563: [RISCV] Add DAGCombine to fold base operation and reduction.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 20:55:33 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:7254
+  if (Opc == ISD::FADD && !N->getFlags().hasAllowReassociation() &&
+      ReduceIdx == 0)
+    return SDValue();
----------------
fakepaper56 wrote:
> craig.topper wrote:
> > The ReduceIdx is relevant here. The order of the fadd operands doesn't matter. The reduce operation is before the fadd, we need to know if the fadd can be moved before the reduce.
> VECREDUCE_FADD_VL always has reassociation, so I think I only need to check `N->getFlags().hasAllowReassociation()` to make sure fadd can be moved before the reduce.
I meant to say “ReduceIdx ISN’T relevant”


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122563



More information about the llvm-commits mailing list