[llvm] [DAG] Replace getValid*ShiftAmountConstant helpers with getValid*ShiftAmount helpers to support KnownBits analysis (PR #93182)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 16:53:26 PDT 2024


================
@@ -2598,11 +2595,11 @@ bool TargetLowering::SimplifyDemandedBits(
         break;
 
       if (Src.getNode()->hasOneUse()) {
-        const APInt *ShAmtC =
-            TLO.DAG.getValidShiftAmountConstant(Src, DemandedElts);
-        if (!ShAmtC || ShAmtC->uge(BitWidth))
+        std::optional<uint64_t> ShAmtC =
+            TLO.DAG.getValidShiftAmount(Src, DemandedElts, Depth + 2);
+        if (!ShAmtC || *ShAmtC >= BitWidth)
----------------
RKSimon wrote:

These are 'inner' shifts of shifts. The originals should have used Depth+1 but that was missed. 

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


More information about the llvm-commits mailing list