Skip to content

Commit 976f877

Browse files
committed
[X86] ExtendToType - directly initialize SmallVector with build vector operands. NFC.
Don't push_back the operands separately.
1 parent 431975b commit 976f877

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32649,8 +32649,7 @@ static SDValue ExtendToType(SDValue InOp, MVT NVT, SelectionDAG &DAG,
3264932649
"Unexpected request for vector widening");
3265032650

3265132651
SDLoc dl(InOp);
32652-
if (InOp.getOpcode() == ISD::CONCAT_VECTORS &&
32653-
InOp.getNumOperands() == 2) {
32652+
if (InOp.getOpcode() == ISD::CONCAT_VECTORS && InOp.getNumOperands() == 2) {
3265432653
SDValue N1 = InOp.getOperand(1);
3265532654
if ((ISD::isBuildVectorAllZeros(N1.getNode()) && FillWithZeroes) ||
3265632655
N1.isUndef()) {
@@ -32661,22 +32660,17 @@ static SDValue ExtendToType(SDValue InOp, MVT NVT, SelectionDAG &DAG,
3266132660
}
3266232661
if (ISD::isBuildVectorOfConstantSDNodes(InOp.getNode()) ||
3266332662
ISD::isBuildVectorOfConstantFPSDNodes(InOp.getNode())) {
32664-
SmallVector<SDValue, 16> Ops;
32665-
for (unsigned i = 0; i < InNumElts; ++i)
32666-
Ops.push_back(InOp.getOperand(i));
32667-
3266832663
EVT EltVT = InOp.getOperand(0).getValueType();
32669-
32670-
SDValue FillVal = FillWithZeroes ? DAG.getConstant(0, dl, EltVT) :
32671-
DAG.getUNDEF(EltVT);
32672-
for (unsigned i = 0; i < WidenNumElts - InNumElts; ++i)
32673-
Ops.push_back(FillVal);
32664+
SDValue FillVal =
32665+
FillWithZeroes ? DAG.getConstant(0, dl, EltVT) : DAG.getUNDEF(EltVT);
32666+
SmallVector<SDValue, 16> Ops(InOp->op_begin(), InOp->op_end());
32667+
Ops.append(WidenNumElts - InNumElts, FillVal);
3267432668
return DAG.getBuildVector(NVT, dl, Ops);
3267532669
}
32676-
SDValue FillVal = FillWithZeroes ? DAG.getConstant(0, dl, NVT) :
32677-
DAG.getUNDEF(NVT);
32678-
return DAG.getNode(ISD::INSERT_SUBVECTOR, dl, NVT, FillVal,
32679-
InOp, DAG.getIntPtrConstant(0, dl));
32670+
SDValue FillVal =
32671+
FillWithZeroes ? DAG.getConstant(0, dl, NVT) : DAG.getUNDEF(NVT);
32672+
return DAG.getNode(ISD::INSERT_SUBVECTOR, dl, NVT, FillVal, InOp,
32673+
DAG.getIntPtrConstant(0, dl));
3268032674
}
3268132675

3268232676
static SDValue LowerMSCATTER(SDValue Op, const X86Subtarget &Subtarget,

0 commit comments

Comments
 (0)