[PATCH] D143373: [InstCombine] fold icmp of the sum of ext bool based on limited range

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 00:54:09 PST 2023


bcl5980 created this revision.
bcl5980 added reviewers: spatel, nikic.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
bcl5980 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

For the pattern: (zext i1 X) + (sext i1 Y)), C
 when 
C == -1 means, X == false ,Y == true
C == 0 means , X == Y
C == 1 means, X == true, Y == false
So based on these info we can simplify the icmp to logical operations.

Fix: https://github.com/llvm/llvm-project/issues/59666


https://reviews.llvm.org/D143373

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143373.495017.patch
Type: text/x-patch
Size: 8151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230206/2bc345fc/attachment-0001.bin>


More information about the llvm-commits mailing list