[PATCH] D118061: [InstCombine] fold one-bit set/clear icmp with mul operand

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 24 11:58:07 PST 2022


spatel created this revision.
spatel added reviewers: fwolff, lebedev.ri, RKSimon, efriedma, xbolva00.
Herald added subscribers: hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

((X1 * C1 <https://reviews.llvm.org/C1>) & C2) ==/!= 0 --> (X1 & 1) ==/!= 0

  iff C2 is a power-of-2 and C1 is a multiple of C2, and C2 does not have known zero low-bits set

This is a reduced form of one proposed transform in D114272 <https://reviews.llvm.org/D114272>.

If I translated the pre-conditions correctly, then this is just a test of the LSB of the input operand:
https://alive2.llvm.org/ce/z/YB_4pn


https://reviews.llvm.org/D118061

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/icmp-mul-and.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118061.402617.patch
Type: text/x-patch
Size: 5252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220124/3cf56545/attachment.bin>


More information about the llvm-commits mailing list