[PATCH] D128790: [InstCombine] improve fold for icmp_eq_and to icmp_ult
Chenbing.Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 4 19:59:55 PDT 2022
Chenbing.Zheng added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1786
// ((%x & C) == 0) --> %x u< (-C) iff (-C) is power of two.
- if ((~(*C2) + 1).isPowerOf2()) {
- Constant *NegBOC =
- ConstantExpr::getNeg(cast<Constant>(And->getOperand(1)));
+ if ((~(NewC2) + 1).isPowerOf2()) {
+ Constant *NegBOC = ConstantInt::get(And->getType(), -NewC2);
----------------
spatel wrote:
> I think this should be updated to use `isNegatedPowerOf2` - if that's correct, you could even commit that change as a NFC patch before this one.
I agree with you, https://reviews.llvm.org/D129103
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128790/new/
https://reviews.llvm.org/D128790
More information about the llvm-commits
mailing list