[PATCH] D114386: [InstCombine] use decomposeBitTestICmp to make icmp (trunc X), C more consistent

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 12:38:57 PST 2021


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

This is a follow-on suggested in D112634 <https://reviews.llvm.org/D112634>. Two folds that were added with that patch are subsumed in the call to decomposeBitTestICmp, and two other folds are potentially inverted. The deleted folds were very specialized by instcombine standards because they were restricted to legal integer types based on the data layout. This generalizes the canonical form independent of target/types.

This change has a reasonable chance of exposing regressions either in IR or codegen, but I don't have any evidence for either of those yet. A spot check of asm across several in-tree targets shows variations that I expect are mostly neutral.

We have one improvement in an existing IR test that I noted with a comment. Using mask ops might also make more code match with D114272 <https://reviews.llvm.org/D114272>.


https://reviews.llvm.org/D114386

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/and-compare.ll
  llvm/test/Transforms/InstCombine/compare-signs.ll
  llvm/test/Transforms/InstCombine/getelementptr.ll
  llvm/test/Transforms/InstCombine/icmp-trunc.ll
  llvm/test/Transforms/InstCombine/select-icmp-and.ll
  llvm/test/Transforms/InstCombine/select-with-bitwise-ops.ll
  llvm/test/Transforms/InstCombine/signed-truncation-check.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114386.388992.patch
Type: text/x-patch
Size: 19994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211122/ae29fb7c/attachment.bin>


More information about the llvm-commits mailing list