eq/ne are generally easier to reason about elsewhere.
ult -> ne: https://alive2.llvm.org/ce/z/5wxXGt
uge -> eq: https://alive2.llvm.org/ce/z/Dw6kqG
Paths
| Differential D145425
[InstCombine] Transform `(icmp ult/uge (and X, Y), X)` -> `(icmp ne/eq (and X, Y), X)` ClosedPublic Authored by goldstein.w.n on Mar 6 2023, 2:16 PM.
Details Summary eq/ne are generally easier to reason about elsewhere. ult -> ne: https://alive2.llvm.org/ce/z/5wxXGt
Diff Detail
Event TimelineThis revision is now accepted and ready to land.May 28 2023, 3:40 AM
goldstein.w.n edited child revisions, added: D159325: [InstCombine] Rename some shadow variables; NFC; removed: D159056: [InstCombine] Make `isFreeToInvert` check recursively..Aug 31 2023, 6:36 PM This revision was landed with ongoing or failed builds.Sep 13 2023, 1:50 PM Closed by commit rG119194ada638: [InstCombine] Transform `(icmp ult/uge (and X, Y), X)` -> `(icmp ne/eq (and X… (authored by goldstein.w.n). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 502803 llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll
llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ugt-to-icmp-ugt.ll
llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll
llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ult-to-icmp-ugt.ll
llvm/test/Transforms/InstCombine/icmp-of-and-x.ll
|
For symmetry with the or fold, I think we want X & Y == Y to X | ~Y == -1 for freely invertible Y (https://alive2.llvm.org/ce/z/wt3Cg6).