[PATCH] D141990: [InstSimplify] Add transform ctpop(X) -> 1 iff X is non-zero power of 2
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 10:40:03 PST 2023
goldstein.w.n marked an inline comment as done.
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:623-627
+ // ctpop(X) -> 1 iff X is non-zero power of 2. Maybe better also to just
+ // return icmp X, 0 if its known power of 2 but not known non-zero.
+ if (IC.isKnownToBeAPowerOfTwo(Op0, /* OrZero */ false))
+ return IC.replaceInstUsesWith(II, ConstantInt::get(Ty, 1));
----------------
majnemer wrote:
> Should this be in simplifyIntrinsic?
> Should this be in simplifyIntrinsic?
Moved.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141990/new/
https://reviews.llvm.org/D141990
More information about the llvm-commits
mailing list