[llvm] [KnownBits] Implement knownbits lshr/ashr with exact flag (PR #84254)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 01:27:09 PST 2024
================
@@ -565,7 +565,9 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
KnownBits ExtKnown = KnownBits::makeConstant(APInt(BitWidth, BitWidth));
KnownBits ShiftKnown = KnownBits::computeForAddSub(
/*Add=*/false, /*NSW=*/false, /* NUW=*/false, ExtKnown, WidthKnown);
- Known = KnownBits::ashr(KnownBits::shl(Known, ShiftKnown), ShiftKnown);
+ Known = KnownBits::ashr(KnownBits::shl(Known, ShiftKnown), ShiftKnown,
+ /*ShAmtNonZero=*/false,
+ /*Exact*/ true);
----------------
jayfoad wrote:
> Could you read the Exact flag from the llvm::MachineInstr?
No, this is not related to whether the G_SBFX itself is exact. This is only exact because we're operating on the result of extractBits, which will leave zero bits outside of the masked value.
https://github.com/llvm/llvm-project/pull/84254
More information about the llvm-commits
mailing list