@@ -3517,12 +3517,12 @@ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT, const SDLoc &DL,
35173517 const RISCVSubtarget &Subtarget) {
35183518 if (SplatVal.getOpcode() != ISD::EXTRACT_VECTOR_ELT)
35193519 return SDValue();
3520- SDValue Vec = SplatVal.getOperand(0);
3520+ SDValue Src = SplatVal.getOperand(0);
35213521 // Don't perform this optimization for i1 vectors, or if the element types are
35223522 // different
35233523 // FIXME: Support i1 vectors, maybe by promoting to i8?
35243524 MVT EltTy = VT.getVectorElementType();
3525- MVT SrcVT = Vec .getSimpleValueType();
3525+ MVT SrcVT = Src .getSimpleValueType();
35263526 if (EltTy == MVT::i1 || EltTy != SrcVT.getVectorElementType())
35273527 return SDValue();
35283528 SDValue Idx = SplatVal.getOperand(1);
@@ -3545,29 +3545,26 @@ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT, const SDLoc &DL,
35453545 MVT SrcContainerVT = SrcVT;
35463546 if (SrcVT.isFixedLengthVector()) {
35473547 SrcContainerVT = getContainerForFixedLengthVector(DAG, SrcVT, Subtarget);
3548- Vec = convertToScalableVector(SrcContainerVT, Vec , DAG, Subtarget);
3548+ Src = convertToScalableVector(SrcContainerVT, Src , DAG, Subtarget);
35493549 }
35503550
35513551 // Put Vec in a VT sized vector
35523552 if (SrcContainerVT.getVectorMinNumElements() <
35533553 ContainerVT.getVectorMinNumElements())
3554- Vec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ContainerVT,
3555- DAG.getUNDEF(ContainerVT), Vec ,
3554+ Src = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ContainerVT,
3555+ DAG.getUNDEF(ContainerVT), Src ,
35563556 DAG.getVectorIdxConstant(0, DL));
35573557 else
3558- Vec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, Vec ,
3558+ Src = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, Src ,
35593559 DAG.getVectorIdxConstant(0, DL));
35603560
35613561 // We checked that Idx fits inside VT earlier
35623562 auto [Mask, VL] = getDefaultVLOps(VT, ContainerVT, DL, DAG, Subtarget);
3563-
3564- SDValue Gather = DAG.getNode(RISCVISD::VRGATHER_VX_VL, DL, ContainerVT, Vec,
3563+ SDValue Gather = DAG.getNode(RISCVISD::VRGATHER_VX_VL, DL, ContainerVT, Src,
35653564 Idx, DAG.getUNDEF(ContainerVT), Mask, VL);
3566-
3567- if (!VT.isFixedLengthVector())
3568- return Gather;
3569-
3570- return convertFromScalableVector(VT, Gather, DAG, Subtarget);
3565+ if (VT.isFixedLengthVector())
3566+ Gather = convertFromScalableVector(VT, Gather, DAG, Subtarget);
3567+ return Gather;
35713568}
35723569
35733570/// Try and optimize BUILD_VECTORs with "dominant values" - these are values
0 commit comments