[llvm] [X86] Fix miscompile in combineShiftRightArithmetic (PR #86597)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 09:40:18 PDT 2024


================
@@ -47406,10 +47406,13 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG,
     return DAG.getNode(X86ISD::VSRAV, DL, N->getVTList(), N0, ShrAmtVal);
   }
 
-  // fold (ashr (shl, a, [56,48,32,24,16]), SarConst)
-  // into (shl, (sext (a), [56,48,32,24,16] - SarConst)) or
-  // into (lshr, (sext (a), SarConst - [56,48,32,24,16]))
-  // depending on sign of (SarConst - [56,48,32,24,16])
+  // fold (SRA (SHL X, ShlConst), SraConst)
+  // into (SHL (sext_in_reg X), ShlConst - SraConst)
+  //   or (sext_in_reg X)
+  //   or (SRA (sext_in_reg X), SraConst - ShlConst)
+  // depending on relation betwen SraConst and ShlConst.
----------------
topperc wrote:

between*

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


More information about the llvm-commits mailing list