[PATCH] D141086: [SDAG] try to avoid multiply for X*Y==0

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 13:22:51 PST 2023


spatel created this revision.
spatel added reviewers: dmgreen, RKSimon, goldstein.w.n, nikic.
Herald added subscribers: pengfei, hiraditya, mcrosier.
Herald added a project: All.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Forking this off from D140850 <https://reviews.llvm.org/D140850> -
https://alive2.llvm.org/ce/z/Qk334e

We could almost justify doing this in IR, but consideration for minsize compiles requires that we only try it in codegen -- the transform is not reversible.

In all other cases, avoiding multiply should be a win because a mul is more expensive than simple/parallelizable compares. AArch even has a trick (assuming that's the correct asm) to keep instruction count even for some types.


https://reviews.llvm.org/D141086

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/AArch64/aarch64-dup-ext.ll
  llvm/test/CodeGen/AArch64/mul-cmp.ll
  llvm/test/CodeGen/X86/mul-cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141086.486655.patch
Type: text/x-patch
Size: 12715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230105/00d031de/attachment.bin>


More information about the llvm-commits mailing list