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

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 01:18:22 PDT 2024


================
@@ -47428,6 +47428,8 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG,
   APInt SarConst = N1->getAsAPIntVal();
   EVT CVT = N1.getValueType();
 
+  if (CVT != N01.getValueType())
----------------
bjope wrote:

I've cleaned up a bit now:
- fixed the lshr->ashr thing (actually using SRA/SHL now, instead of the IR names when describing the folds)
- renamed SarConst -> SraConst
- got rid of the [56,48,32,24,16] comments (I did not really understand those comments and they did not fully match what the code was doing afaict)
   
   

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


More information about the llvm-commits mailing list