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

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 19 05:13:23 PDT 2021


benshi001 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;
----------------
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.


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

https://reviews.llvm.org/D107711



More information about the llvm-commits mailing list