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

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 19 05:57:11 PDT 2021


luismarques 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;
----------------
jrtc27 wrote:
> 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.
Sorry, ignore the part about the equals :) I mixed some thoughts when writing that.


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

https://reviews.llvm.org/D107711



More information about the llvm-commits mailing list