[InstCombine] Use pointer alignment in SimplifyDemandedBits

For parity with computeKnownBits(). This came up when adding a
consistency assertion.
This commit is contained in:
Nikita Popov 2023-11-30 12:45:38 +01:00
parent b703bd821d
commit b8a5a015d1

View File

@ -1022,6 +1022,11 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
}
}
if (V->getType()->isPointerTy()) {
Align Alignment = V->getPointerAlignment(DL);
Known.Zero.setLowBits(Log2(Alignment));
}
// If the client is only demanding bits that we know, return the known
// constant. We can't directly simplify pointers as a constant because of
// pointer provenance.