Skip to content

Commit 759422c

Browse files
committed
[DAG] visitEXTRACT_SUBVECTOR - pull out repeated SDLoc. NFC.
1 parent b800a93 commit 759422c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24433,6 +24433,7 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2443324433
EVT NVT = N->getValueType(0);
2443424434
SDValue V = N->getOperand(0);
2443524435
uint64_t ExtIdx = N->getConstantOperandVal(1);
24436+
SDLoc DL(N);
2443624437

2443724438
// Extract from UNDEF is UNDEF.
2443824439
if (V.isUndef())
@@ -24448,7 +24449,7 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2444824449
if (TLI.isExtractSubvectorCheap(NVT, V.getOperand(0).getValueType(),
2444924450
V.getConstantOperandVal(1)) &&
2445024451
TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NVT)) {
24451-
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, SDLoc(N), NVT, V.getOperand(0),
24452+
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NVT, V.getOperand(0),
2445224453
V.getOperand(1));
2445324454
}
2445424455
}
@@ -24457,7 +24458,7 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2445724458
if (V.getOpcode() == ISD::SPLAT_VECTOR)
2445824459
if (DAG.isConstantValueOfAnyType(V.getOperand(0)) || V.hasOneUse())
2445924460
if (!LegalOperations || TLI.isOperationLegal(ISD::SPLAT_VECTOR, NVT))
24460-
return DAG.getSplatVector(NVT, SDLoc(N), V.getOperand(0));
24461+
return DAG.getSplatVector(NVT, DL, V.getOperand(0));
2446124462

2446224463
// Try to move vector bitcast after extract_subv by scaling extraction index:
2446324464
// extract_subv (bitcast X), Index --> bitcast (extract_subv X, Index')
@@ -24471,10 +24472,9 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2447124472
if ((SrcNumElts % DestNumElts) == 0) {
2447224473
unsigned SrcDestRatio = SrcNumElts / DestNumElts;
2447324474
ElementCount NewExtEC = NVT.getVectorElementCount() * SrcDestRatio;
24474-
EVT NewExtVT = EVT::getVectorVT(*DAG.getContext(), SrcVT.getScalarType(),
24475-
NewExtEC);
24475+
EVT NewExtVT =
24476+
EVT::getVectorVT(*DAG.getContext(), SrcVT.getScalarType(), NewExtEC);
2447624477
if (TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NewExtVT)) {
24477-
SDLoc DL(N);
2447824478
SDValue NewIndex = DAG.getVectorIdxConstant(ExtIdx * SrcDestRatio, DL);
2447924479
SDValue NewExtract = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NewExtVT,
2448024480
V.getOperand(0), NewIndex);
@@ -24488,7 +24488,6 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2448824488
NVT.getVectorElementCount().divideCoefficientBy(DestSrcRatio);
2448924489
EVT ScalarVT = SrcVT.getScalarType();
2449024490
if ((ExtIdx % DestSrcRatio) == 0) {
24491-
SDLoc DL(N);
2449224491
unsigned IndexValScaled = ExtIdx / DestSrcRatio;
2449324492
EVT NewExtVT =
2449424493
EVT::getVectorVT(*DAG.getContext(), ScalarVT, NewExtEC);
@@ -24536,7 +24535,6 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2453624535
// v2i8 extract_subvec v8i8 Y, 6
2453724536
if (NVT.isFixedLengthVector() && ConcatSrcVT.isFixedLengthVector() &&
2453824537
ConcatSrcNumElts % ExtNumElts == 0) {
24539-
SDLoc DL(N);
2454024538
unsigned NewExtIdx = ExtIdx - ConcatOpIdx * ConcatSrcNumElts;
2454124539
assert(NewExtIdx + ExtNumElts <= ConcatSrcNumElts &&
2454224540
"Trying to extract from >1 concat operand?");
@@ -24575,13 +24573,13 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2457524573
if (NumElems == 1) {
2457624574
SDValue Src = V->getOperand(IdxVal);
2457724575
if (EltVT != Src.getValueType())
24578-
Src = DAG.getNode(ISD::TRUNCATE, SDLoc(N), EltVT, Src);
24576+
Src = DAG.getNode(ISD::TRUNCATE, DL, EltVT, Src);
2457924577
return DAG.getBitcast(NVT, Src);
2458024578
}
2458124579

2458224580
// Extract the pieces from the original build_vector.
24583-
SDValue BuildVec = DAG.getBuildVector(ExtractVT, SDLoc(N),
24584-
V->ops().slice(IdxVal, NumElems));
24581+
SDValue BuildVec =
24582+
DAG.getBuildVector(ExtractVT, DL, V->ops().slice(IdxVal, NumElems));
2458524583
return DAG.getBitcast(NVT, BuildVec);
2458624584
}
2458724585
}
@@ -24608,7 +24606,7 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2460824606
return DAG.getBitcast(NVT, V.getOperand(1));
2460924607
}
2461024608
return DAG.getNode(
24611-
ISD::EXTRACT_SUBVECTOR, SDLoc(N), NVT,
24609+
ISD::EXTRACT_SUBVECTOR, DL, NVT,
2461224610
DAG.getBitcast(N->getOperand(0).getValueType(), V.getOperand(0)),
2461324611
N->getOperand(1));
2461424612
}

0 commit comments

Comments
 (0)