[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
Sat Aug 12 13:05:33 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);
+
----------------
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).


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