@@ -14609,17 +14609,18 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14609
14609
EVT VT = N->getValueType(0);
14610
14610
EVT SrcVT = N0.getValueType();
14611
14611
bool isLE = DAG.getDataLayout().isLittleEndian();
14612
+ SDLoc DL(N);
14612
14613
14613
14614
// trunc(undef) = undef
14614
14615
if (N0.isUndef())
14615
14616
return DAG.getUNDEF(VT);
14616
14617
14617
14618
// fold (truncate (truncate x)) -> (truncate x)
14618
14619
if (N0.getOpcode() == ISD::TRUNCATE)
14619
- return DAG.getNode(ISD::TRUNCATE, SDLoc(N) , VT, N0.getOperand(0));
14620
+ return DAG.getNode(ISD::TRUNCATE, DL , VT, N0.getOperand(0));
14620
14621
14621
14622
// fold (truncate c1) -> c1
14622
- if (SDValue C = DAG.FoldConstantArithmetic(ISD::TRUNCATE, SDLoc(N) , VT, {N0}))
14623
+ if (SDValue C = DAG.FoldConstantArithmetic(ISD::TRUNCATE, DL , VT, {N0}))
14623
14624
return C;
14624
14625
14625
14626
// fold (truncate (ext x)) -> (ext x) or (truncate x) or x
@@ -14628,10 +14629,10 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14628
14629
N0.getOpcode() == ISD::ANY_EXTEND) {
14629
14630
// if the source is smaller than the dest, we still need an extend.
14630
14631
if (N0.getOperand(0).getValueType().bitsLT(VT))
14631
- return DAG.getNode(N0.getOpcode(), SDLoc(N) , VT, N0.getOperand(0));
14632
+ return DAG.getNode(N0.getOpcode(), DL , VT, N0.getOperand(0));
14632
14633
// if the source is larger than the dest, than we just need the truncate.
14633
14634
if (N0.getOperand(0).getValueType().bitsGT(VT))
14634
- return DAG.getNode(ISD::TRUNCATE, SDLoc(N) , VT, N0.getOperand(0));
14635
+ return DAG.getNode(ISD::TRUNCATE, DL , VT, N0.getOperand(0));
14635
14636
// if the source and dest are the same type, we can drop both the extend
14636
14637
// and the truncate.
14637
14638
return N0.getOperand(0);
@@ -14645,8 +14646,8 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14645
14646
SDValue ExtVal = N0.getOperand(1);
14646
14647
EVT ExtVT = cast<VTSDNode>(ExtVal)->getVT();
14647
14648
if (ExtVT.bitsLT(VT) && TLI.preferSextInRegOfTruncate(VT, SrcVT, ExtVT)) {
14648
- SDValue TrX = DAG.getNode(ISD::TRUNCATE, SDLoc(N) , VT, X);
14649
- return DAG.getNode(ISD::SIGN_EXTEND_INREG, SDLoc(N) , VT, TrX, ExtVal);
14649
+ SDValue TrX = DAG.getNode(ISD::TRUNCATE, DL , VT, X);
14650
+ return DAG.getNode(ISD::SIGN_EXTEND_INREG, DL , VT, TrX, ExtVal);
14650
14651
}
14651
14652
}
14652
14653
@@ -14681,8 +14682,6 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14681
14682
if (isa<ConstantSDNode>(EltNo) && isTypeLegal(NVT)) {
14682
14683
int Elt = EltNo->getAsZExtVal();
14683
14684
int Index = isLE ? (Elt*SizeRatio) : (Elt*SizeRatio + (SizeRatio-1));
14684
-
14685
- SDLoc DL(N);
14686
14685
return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, TrTy,
14687
14686
DAG.getBitcast(NVT, N0.getOperand(0)),
14688
14687
DAG.getVectorIdxConstant(Index, DL));
@@ -14697,7 +14696,7 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14697
14696
SDValue Cond = N0.getOperand(0);
14698
14697
SDValue TruncOp0 = DAG.getNode(ISD::TRUNCATE, SL, VT, N0.getOperand(1));
14699
14698
SDValue TruncOp1 = DAG.getNode(ISD::TRUNCATE, SL, VT, N0.getOperand(2));
14700
- return DAG.getNode(ISD::SELECT, SDLoc(N) , VT, Cond, TruncOp0, TruncOp1);
14699
+ return DAG.getNode(ISD::SELECT, DL , VT, Cond, TruncOp0, TruncOp1);
14701
14700
}
14702
14701
}
14703
14702
@@ -14709,15 +14708,13 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14709
14708
KnownBits Known = DAG.computeKnownBits(Amt);
14710
14709
unsigned Size = VT.getScalarSizeInBits();
14711
14710
if (Known.countMaxActiveBits() <= Log2_32(Size)) {
14712
- SDLoc SL(N);
14713
14711
EVT AmtVT = TLI.getShiftAmountTy(VT, DAG.getDataLayout());
14714
-
14715
- SDValue Trunc = DAG.getNode(ISD::TRUNCATE, SL, VT, N0.getOperand(0));
14712
+ SDValue Trunc = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(0));
14716
14713
if (AmtVT != Amt.getValueType()) {
14717
- Amt = DAG.getZExtOrTrunc(Amt, SL , AmtVT);
14714
+ Amt = DAG.getZExtOrTrunc(Amt, DL , AmtVT);
14718
14715
AddToWorklist(Amt.getNode());
14719
14716
}
14720
- return DAG.getNode(ISD::SHL, SL , VT, Trunc, Amt);
14717
+ return DAG.getNode(ISD::SHL, DL , VT, Trunc, Amt);
14721
14718
}
14722
14719
}
14723
14720
@@ -14733,7 +14730,6 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14733
14730
TLI.isTruncateFree(SrcVT.getScalarType(), VT.getScalarType()) &&
14734
14731
// Avoid creating illegal types if running after type legalizer.
14735
14732
(!LegalTypes || TLI.isTypeLegal(VT.getScalarType()))) {
14736
- SDLoc DL(N);
14737
14733
EVT SVT = VT.getScalarType();
14738
14734
SmallVector<SDValue, 8> TruncOps;
14739
14735
for (const SDValue &Op : N0->op_values()) {
@@ -14747,7 +14743,6 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14747
14743
if (N0.getOpcode() == ISD::SPLAT_VECTOR &&
14748
14744
(!LegalTypes || TLI.isTypeLegal(VT.getScalarType())) &&
14749
14745
(!LegalOperations || TLI.isOperationLegal(ISD::SPLAT_VECTOR, VT))) {
14750
- SDLoc DL(N);
14751
14746
EVT SVT = VT.getScalarType();
14752
14747
return DAG.getSplatVector(
14753
14748
VT, DL, DAG.getNode(ISD::TRUNCATE, DL, SVT, N0->getOperand(0)));
@@ -14779,7 +14774,7 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14779
14774
for (unsigned i = 0, e = BuildVecNumElts; i != e; i += TruncEltOffset)
14780
14775
Opnds.push_back(BuildVect.getOperand(i));
14781
14776
14782
- return DAG.getBuildVector(VT, SDLoc(N) , Opnds);
14777
+ return DAG.getBuildVector(VT, DL , Opnds);
14783
14778
}
14784
14779
}
14785
14780
@@ -14842,7 +14837,7 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14842
14837
AddToWorklist(NV.getNode());
14843
14838
Opnds.push_back(NV);
14844
14839
}
14845
- return DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(N) , VT, Opnds);
14840
+ return DAG.getNode(ISD::CONCAT_VECTORS, DL , VT, Opnds);
14846
14841
}
14847
14842
}
14848
14843
@@ -14856,11 +14851,9 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14856
14851
if (VecSrcVT.isVector() && VecSrcVT.getScalarType() == VT &&
14857
14852
(!LegalOperations ||
14858
14853
TLI.isOperationLegal(ISD::EXTRACT_VECTOR_ELT, VecSrcVT))) {
14859
- SDLoc SL(N);
14860
-
14861
14854
unsigned Idx = isLE ? 0 : VecSrcVT.getVectorNumElements() - 1;
14862
- return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, SL , VT, VecSrc,
14863
- DAG.getVectorIdxConstant(Idx, SL ));
14855
+ return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL , VT, VecSrc,
14856
+ DAG.getVectorIdxConstant(Idx, DL ));
14864
14857
}
14865
14858
}
14866
14859
@@ -14905,7 +14898,6 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14905
14898
// we are extra cautious to not create an unsupported operation.
14906
14899
// Target-specific changes are likely needed to avoid regressions here.
14907
14900
if (VT.isScalarInteger() || TLI.isOperationLegal(N0.getOpcode(), VT)) {
14908
- SDLoc DL(N);
14909
14901
SDValue NarrowL = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(0));
14910
14902
SDValue NarrowR = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(1));
14911
14903
return DAG.getNode(N0.getOpcode(), DL, VT, NarrowL, NarrowR);
@@ -14922,7 +14914,6 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14922
14914
if (((!LegalOperations && N0.getOpcode() == ISD::UADDO_CARRY) ||
14923
14915
TLI.isOperationLegal(N0.getOpcode(), VT)) &&
14924
14916
N0.hasOneUse() && !N0->hasAnyUseOfValue(1)) {
14925
- SDLoc DL(N);
14926
14917
SDValue X = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(0));
14927
14918
SDValue Y = DAG.getNode(ISD::TRUNCATE, DL, VT, N0.getOperand(1));
14928
14919
SDVTList VTs = DAG.getVTList(VT, N0->getValueType(1));
@@ -14939,7 +14930,7 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
14939
14930
VT.getScalarSizeInBits() &&
14940
14931
hasOperation(N0.getOpcode(), VT)) {
14941
14932
return getTruncatedUSUBSAT(VT, SrcVT, N0.getOperand(0), N0.getOperand(1),
14942
- DAG, SDLoc(N) );
14933
+ DAG, DL );
14943
14934
}
14944
14935
break;
14945
14936
}
0 commit comments