[PATCH] D145425: [InstCombine] Transform `(icmp ult/uge (and X, Y), X)` -> `(icmp ne/eq (and X, Y), X)`
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 27 11:38:35 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4222
+ if (Pred == ICmpInst::ICMP_UGE)
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
+
----------------
nikic wrote:
> 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).
And `X & Y == Y` to `~X & Y == 0` as well, based on what the final version of D144610 implemented.
IIRC one of those folds also got implemented for constants previously, so we can drop that then.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145425/new/
https://reviews.llvm.org/D145425
More information about the llvm-commits
mailing list