[DAGCombiner] When combining (sext_inreg (zext X), VT) -> (sext X) don't pass along...
authorCraig Topper <craig.topper@sifive.com>
Thu, 15 Jun 2023 18:42:21 +0000 (11:42 -0700)
committerCraig Topper <craig.topper@sifive.com>
Thu, 15 Jun 2023 18:47:42 +0000 (11:47 -0700)
ISD::SIGN_EXTEND is only supposed to have one operand, but we
were creating it with 2 operands.

Since we basically never check for extra operands this went
unnoticed.

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 815c94b..4549444 100644 (file)
@@ -14076,7 +14076,7 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) {
     SDValue N00 = N0.getOperand(0);
     if (N00.getScalarValueSizeInBits() == ExtVTBits &&
         (!LegalOperations || TLI.isOperationLegal(ISD::SIGN_EXTEND, VT)))
-      return DAG.getNode(ISD::SIGN_EXTEND, SDLoc(N), VT, N00, N1);
+      return DAG.getNode(ISD::SIGN_EXTEND, SDLoc(N), VT, N00);
   }
 
   // fold (sext_in_reg x) -> (zext_in_reg x) if the sign bit is known zero.