Simplify 'shl' inequality test into 'and' equality test.
This pattern happens in the middle-end while simplifying bitfield access,
Exposed in https://reviews.llvm.org/D63505
Paths
| Differential D63675
[InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp eq/ne (and %x, (lshr -C1, C2)), 0. ClosedPublic Authored by huihuiz on Jun 21 2019, 2:56 PM.
Details Summary Simplify 'shl' inequality test into 'and' equality test. This pattern happens in the middle-end while simplifying bitfield access,
Diff Detail
Event TimelineComment Actions Nice, some comments.
This revision now requires changes to proceed.Jun 23 2019, 2:59 PM lebedev.ri marked an inline comment as done. Comment ActionsLooks good, thank you.
This revision is now accepted and ready to land.Jun 24 2019, 3:13 PM
Closed by commit rGb90cb57b63ae: [InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two ->… (authored by huihuiz). · Explain WhyJun 25 2019, 1:49 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 206320 llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/pr17827.ll
llvm/test/Transforms/InstCombine/shl-unsigned-cmp-const.ll
|
This comment is for the second fold, for the first fold the comment is