[PATCH] D127474: [SelectionDAG] fold Op0 - (X * MulC) --> Op0 + (X << log2(-MulC))
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 13 08:55:48 PDT 2022
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - as noted in 21d7c3bcc646f5db73b <https://reviews.llvm.org/rG21d7c3bcc646f5db73bc3d21f9d1b1327b6a5ec0>, this pattern is probably not common because it's not the canonical IR.
A more interesting case is where the mul is operand 0 of the sub. We would not transform that in IR because it needs a negation, but removing the multiply looks better on several targets (RISCV, AArch64, x86). It's probably a win for any target where multiply is slower than the fastest ALU op, and we're not optimizing strictly for size.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127474/new/
https://reviews.llvm.org/D127474
More information about the llvm-commits
mailing list