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

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 19 05:53:52 PDT 2021


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9088
+  // Let the DAGCombiner decide for larger types.
+  if (Subtarget.getXLen() < VT.getScalarSizeInBits())
+    return true;
----------------
benshi001 wrote:
> luismarques wrote:
> > Nit: IMO, it would be more intuitive to compare the other way around, swapping the operands and changing the condition to `>=`.
> I can swap the operands, but why changing the condition to `>=`, should using `>` be better? Since I think this should consider i64 on rv64 and i32 on rv32.
Yes, `>` is correct, and I agree with Luis that this is the more natural way round to express it.


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

https://reviews.llvm.org/D107711



More information about the llvm-commits mailing list