[PATCH] D153148: [InstCombine] Fold `(-1 + zext(B)) & X` into `B ? 0 : X` where B is effectively a bool
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 17 00:56:01 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2569
+ // Op0 & (-1 + zext(A)) --> A ? 0 : Op0
+ if (match(Op0, m_NSWAdd(m_ZExt(m_Value(A)), m_AllOnes())) &&
+ (A->getType()->isIntOrIntVectorTy(1) ||
----------------
goldstein.w.n wrote:
> The add doesn't need to be nsw
Why does this need a zext?
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