[llvm] InstCombine/Demanded: simplify srem case (NFC) (PR #110260)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 27 06:03:19 PDT 2024
================
@@ -861,30 +861,15 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Instruction *I,
// X % -1 demands all the bits because we don't want to introduce
// INT_MIN % -1 (== undef) by accident.
if (match(I->getOperand(1), m_APInt(Rem)) && !Rem->isAllOnes()) {
- APInt RA = Rem->abs();
- if (RA.isPowerOf2()) {
- if (DemandedMask.ult(RA)) // srem won't affect demanded bits
+ if (Rem->isPowerOf2()) {
----------------
nikic wrote:
I'd merge this condition into the preceding if. And actually we can drop `!isAllOnes()` as it's mutually exclusive with `isPowerOf2()`. (But wasn't previously as abs(-1) = 1, which is a power of 2.)
https://github.com/llvm/llvm-project/pull/110260
More information about the llvm-commits
mailing list