[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:

I am extremely sceptical that this change will make any improvement to the KnownBits analysis for G_SBFX. I'd prefer to just remove this part from the patch.

https://github.com/llvm/llvm-project/pull/84254


More information about the llvm-commits mailing list