[PATCH] D153148: [InstCombine] Fold `(-1 + A) & B` into `A ? 0 : B` where A is effectively a bool
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 24 10:04:20 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2609
+ return SelectInst::Create(A, Constant::getNullValue(Ty), B);
+ if (computeKnownBits(A, /* Depth */ 0, &I).countMaxActiveBits() <= 1) {
+ return SelectInst::Create(
----------------
`computeKnownBits(A, /* Depth */ 0, &I).countMaxActiveBits() <= 1` -> `isKnownToBeAPowerOfTwo(A,..., /*OrZero*/true, ...)`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153148/new/
https://reviews.llvm.org/D153148
More information about the llvm-commits
mailing list