[InstCombine] fold icmp of truncated left shift, part 2
authorSanjay Patel <spatel@rotateright.com>
Thu, 8 Sep 2022 16:09:26 +0000 (12:09 -0400)
committerSanjay Patel <spatel@rotateright.com>
Thu, 8 Sep 2022 16:44:02 +0000 (12:44 -0400)
commit444f08c832c8ba67ad595037b58e3ac616a756f1
tree66568188ecf59f82fbb240741c69f0a6cea5e609
parent2944f8ef049fa83ee96159c390fa893f251558da
[InstCombine] fold icmp of truncated left shift, part 2

(trunc (1 << Y) to iN) == 2**C --> Y == C
(trunc (1 << Y) to iN) != 2**C --> Y != C
https://alive2.llvm.org/ce/z/xnFPo5

Follow-up to d9e1f9d7591b0d3e4d. This was a suggested
enhancement mentioned in issue #51889.
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-trunc.ll