@@ -7040,11 +7040,9 @@ SDValue DAGTypeLegalizer::WidenVecOp_INSERT_SUBVECTOR(SDNode *N) {
70407040 SDValue SubVec = N->getOperand (1 );
70417041 SDValue InVec = N->getOperand (0 );
70427042
7043- EVT OrigVT;
7044- if (getTypeAction (SubVec.getValueType ()) == TargetLowering::TypeWidenVector) {
7045- OrigVT = SubVec.getValueType ();
7043+ EVT OrigVT = SubVec.getValueType ();
7044+ if (getTypeAction (SubVec.getValueType ()) == TargetLowering::TypeWidenVector)
70467045 SubVec = GetWidenedVector (SubVec);
7047- }
70487046
70497047 EVT SubVT = SubVec.getValueType ();
70507048
@@ -7067,23 +7065,28 @@ SDValue DAGTypeLegalizer::WidenVecOp_INSERT_SUBVECTOR(SDNode *N) {
70677065 }
70687066 }
70697067
7068+ SDLoc DL (N);
7069+
70707070 // We need to make sure that the indices are still valid, otherwise we might
70717071 // widen what was previously well-defined to something undefined.
70727072 if (IndicesValid && InVec.isUndef () && N->getConstantOperandVal (2 ) == 0 )
7073- return DAG.getNode (ISD::INSERT_SUBVECTOR, SDLoc (N) , VT, InVec, SubVec,
7073+ return DAG.getNode (ISD::INSERT_SUBVECTOR, DL , VT, InVec, SubVec,
70747074 N->getOperand (2 ));
70757075
7076+ if (!IndicesValid || OrigVT.isScalableVector ())
7077+ report_fatal_error (
7078+ " Don't know how to widen the operands for INSERT_SUBVECTOR" );
7079+
70767080 // If the operands can't be widened legally, just replace the INSERT_SUBVECTOR
70777081 // with a series of INSERT_VECTOR_ELT
70787082 unsigned Idx = N->getConstantOperandVal (2 );
70797083
70807084 SDValue InsertElt = InVec;
7081- SDLoc DL (N);
70827085 EVT VectorIdxTy = TLI.getVectorIdxTy (DAG.getDataLayout ());
7083- for (unsigned I = 0 ; I < OrigVT.getVectorNumElements (); ++I) {
7086+ for (unsigned I = 0 , E = OrigVT.getVectorNumElements (); I != E ; ++I) {
70847087 SDValue ExtractElt =
7085- DAG.getNode (ISD::EXTRACT_VECTOR_ELT, DL, VT.getScalarType (), SubVec ,
7086- DAG.getConstant (I, DL, VectorIdxTy));
7088+ DAG.getNode (ISD::EXTRACT_VECTOR_ELT, DL, VT.getVectorElementType () ,
7089+ SubVec, DAG.getConstant (I, DL, VectorIdxTy));
70877090 InsertElt =
70887091 DAG.getNode (ISD::INSERT_VECTOR_ELT, DL, VT, InsertElt, ExtractElt,
70897092 DAG.getConstant (I + Idx, DL, VectorIdxTy));
0 commit comments