This includes basic support for computeKnownBits on abs. I've left FIXMEs for more complicated things we could do.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
The SelectionDAG version does the following, so it would make sense to adapt these here:
// If the source's MSB is zero then we know the rest of the bits already.
if (Known2.isNonNegative()) {
Known.Zero = Known2.Zero;
Known.One = Known2.One;
break;
}
// We only know that the absolute values's MSB will be zero iff there is
// a set bit that isn't the sign bit (otherwise it could be INT_MIN).
Known2.One.clearSignBit();
if (Known2.One.getBoolValue()) {
Known.Zero = APInt::getSignMask(BitWidth);
break;
}Comment Actions
I did think about doing the first change, but I wondered if we would likely end up just removing the ABS in instcombine in that case.