[PATCH] D114962: [Support] improve known bits analysis for multiply with 1-bit op (bool)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 2 08:35:08 PST 2021


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

This can be viewed as recognizing that multiply-by-1 doesn't have any carry bits.

Enhancing canonicalization of mul -> select would also handle these if we were ok with increasing instruction count with casts in some cases.

This doesn't help https://llvm.org/PR49055 , but it's a simpler pattern that we miss.
Note: "-sccp" already gets these examples using a constant range analysis.


https://reviews.llvm.org/D114962

Files:
  llvm/lib/Support/KnownBits.cpp
  llvm/test/Transforms/InstCombine/icmp-mul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114962.391333.patch
Type: text/x-patch
Size: 3601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211202/6972552d/attachment.bin>


More information about the llvm-commits mailing list