[llvm] [DemandedBits] Support non-constant shift amounts (PR #148880)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 04:54:38 PDT 2025


================
@@ -76,6 +76,19 @@ void DemandedBits::determineLiveOperandBits(
           computeKnownBits(V2, Known2, DL, &AC, UserI, &DT);
         }
       };
+  auto GetShiftedRange = [&](unsigned Min, unsigned Max, bool ShiftLeft) {
+    auto ShiftF = [&](const APInt &Mask, unsigned ShiftAmnt) {
+      return ShiftLeft ? Mask.shl(ShiftAmnt) : Mask.lshr(ShiftAmnt);
+    };
+    AB = APInt::getZero(BitWidth);
+    unsigned LoopRange = Max - Min;
+    auto Mask = AOut;
----------------
artagnon wrote:

Nit: could refine this auto to APInt?

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


More information about the llvm-commits mailing list