[PATCH] D107711: [DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 08:34:08 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:2089
+  /// registers.
+  virtual bool isMulAddWithConstNotProfitable(const SDValue &AddNode,
+                                              const SDValue &ConstNode) const {
----------------
Drop the "Not" and return true. Remove the ! from the caller.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9071
+  ConstantSDNode *C2Node = dyn_cast<ConstantSDNode>(ConstNode);
+  assert(C1Node != nullptr && C2Node != nullptr && "constants are expected");
+  const APInt &C1 = C1Node->getAPIntValue();
----------------
Use cast instead of dyn_cast and drop this assert. cast asserts internally.


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

https://reviews.llvm.org/D107711



More information about the llvm-commits mailing list