[PATCH] D84963: [ValueTracking] Add basic computeKnownBits support for llvm.abs intrinsic
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 16:20:09 PDT 2020
craig.topper added a comment.
In D84963#2186141 <https://reviews.llvm.org/D84963#2186141>, @spatel wrote:
> 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;
> }
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.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84963/new/
https://reviews.llvm.org/D84963
More information about the llvm-commits
mailing list