[llvm] [X86][SelectionDAG] Handle the case for gather where index is SHL (PR #139703)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 03:21:15 PDT 2025


================
@@ -56717,7 +56717,8 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
         return SDValue(N, 0);
       }
       if (auto MinShAmt = DAG.getValidMinimumShiftAmount(Index)) {
-        if (*MinShAmt >= 1 && (*MinShAmt + Log2ScaleAmt) < 4 &&
+        if (*MinShAmt >= 1 &&
+            (((*MinShAmt + Log2ScaleAmt) < 4) || (1 + Log2ScaleAmt < 4)) &&
----------------
RKSimon wrote:

Isn't the `(*MinShAmt + Log2ScaleAmt) < 4` case now redundant?

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


More information about the llvm-commits mailing list