@@ -50184,12 +50184,12 @@ static SDValue combineAddOrSubToADCOrSBB(bool IsSub, const SDLoc &DL, EVT VT,
50184
50184
/// If this is an add or subtract where one operand is produced by a cmp+setcc,
50185
50185
/// then try to convert it to an ADC or SBB. This replaces TEST+SET+{ADD/SUB}
50186
50186
/// with CMP+{ADC, SBB}.
50187
- static SDValue combineAddOrSubToADCOrSBB(SDNode *N, SelectionDAG &DAG) {
50187
+ static SDValue combineAddOrSubToADCOrSBB(SDNode *N, const SDLoc &DL,
50188
+ SelectionDAG &DAG) {
50188
50189
bool IsSub = N->getOpcode() == ISD::SUB;
50189
50190
SDValue X = N->getOperand(0);
50190
50191
SDValue Y = N->getOperand(1);
50191
50192
EVT VT = N->getValueType(0);
50192
- SDLoc DL(N);
50193
50193
50194
50194
if (SDValue ADCOrSBB = combineAddOrSubToADCOrSBB(IsSub, DL, VT, X, Y, DAG))
50195
50195
return ADCOrSBB;
@@ -52718,7 +52718,7 @@ static SDValue foldXor1SetCC(SDNode *N, SelectionDAG &DAG) {
52718
52718
return getSETCC(NewCC, LHS->getOperand(1), DL, DAG);
52719
52719
}
52720
52720
52721
- static SDValue combineXorSubCTLZ(SDNode *N, SelectionDAG &DAG,
52721
+ static SDValue combineXorSubCTLZ(SDNode *N, const SDLoc &DL, SelectionDAG &DAG,
52722
52722
const X86Subtarget &Subtarget) {
52723
52723
assert((N->getOpcode() == ISD::XOR || N->getOpcode() == ISD::SUB) &&
52724
52724
"Invalid opcode for combing with CTLZ");
@@ -52758,7 +52758,6 @@ static SDValue combineXorSubCTLZ(SDNode *N, SelectionDAG &DAG,
52758
52758
52759
52759
if (C->getZExtValue() != uint64_t(OpCTLZ.getValueSizeInBits() - 1))
52760
52760
return SDValue();
52761
- SDLoc DL(N);
52762
52761
EVT OpVT = VT;
52763
52762
SDValue Op = OpCTLZ.getOperand(0);
52764
52763
if (VT == MVT::i8) {
@@ -52781,11 +52780,12 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
52781
52780
SDValue N0 = N->getOperand(0);
52782
52781
SDValue N1 = N->getOperand(1);
52783
52782
EVT VT = N->getValueType(0);
52783
+ SDLoc DL(N);
52784
52784
52785
52785
// If this is SSE1 only convert to FXOR to avoid scalarization.
52786
52786
if (Subtarget.hasSSE1() && !Subtarget.hasSSE2() && VT == MVT::v4i32) {
52787
52787
return DAG.getBitcast(MVT::v4i32,
52788
- DAG.getNode(X86ISD::FXOR, SDLoc(N) , MVT::v4f32,
52788
+ DAG.getNode(X86ISD::FXOR, DL , MVT::v4f32,
52789
52789
DAG.getBitcast(MVT::v4f32, N0),
52790
52790
DAG.getBitcast(MVT::v4f32, N1)));
52791
52791
}
@@ -52805,7 +52805,7 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
52805
52805
if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, DCI, Subtarget))
52806
52806
return FPLogic;
52807
52807
52808
- if (SDValue R = combineXorSubCTLZ(N, DAG, Subtarget))
52808
+ if (SDValue R = combineXorSubCTLZ(N, DL, DAG, Subtarget))
52809
52809
return R;
52810
52810
52811
52811
if (DCI.isBeforeLegalizeOps())
@@ -52826,8 +52826,8 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
52826
52826
N0.getOperand(0).getValueType().isVector() &&
52827
52827
N0.getOperand(0).getValueType().getVectorElementType() == MVT::i1 &&
52828
52828
TLI.isTypeLegal(N0.getOperand(0).getValueType()) && N0.hasOneUse()) {
52829
- return DAG.getBitcast(VT, DAG.getNOT(SDLoc(N), N0.getOperand(0),
52830
- N0.getOperand(0).getValueType()));
52829
+ return DAG.getBitcast(
52830
+ VT, DAG.getNOT(DL, N0.getOperand(0), N0.getOperand(0).getValueType()));
52831
52831
}
52832
52832
52833
52833
// Handle AVX512 mask widening.
@@ -52837,8 +52837,8 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
52837
52837
N0.getOpcode() == ISD::INSERT_SUBVECTOR && N0.getOperand(0).isUndef() &&
52838
52838
TLI.isTypeLegal(N0.getOperand(1).getValueType())) {
52839
52839
return DAG.getNode(
52840
- ISD::INSERT_SUBVECTOR, SDLoc(N) , VT, N0.getOperand(0),
52841
- DAG.getNOT(SDLoc(N) , N0.getOperand(1), N0.getOperand(1).getValueType()),
52840
+ ISD::INSERT_SUBVECTOR, DL , VT, N0.getOperand(0),
52841
+ DAG.getNOT(DL , N0.getOperand(1), N0.getOperand(1).getValueType()),
52842
52842
N0.getOperand(2));
52843
52843
}
52844
52844
@@ -52851,7 +52851,6 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
52851
52851
auto *N1C = dyn_cast<ConstantSDNode>(N1);
52852
52852
auto *N001C = dyn_cast<ConstantSDNode>(TruncExtSrc.getOperand(1));
52853
52853
if (N1C && !N1C->isOpaque() && N001C && !N001C->isOpaque()) {
52854
- SDLoc DL(N);
52855
52854
SDValue LHS = DAG.getZExtOrTrunc(TruncExtSrc.getOperand(0), DL, VT);
52856
52855
SDValue RHS = DAG.getZExtOrTrunc(TruncExtSrc.getOperand(1), DL, VT);
52857
52856
return DAG.getNode(ISD::XOR, DL, VT, LHS,
@@ -55419,7 +55418,8 @@ static SDValue combineAddOfPMADDWD(SelectionDAG &DAG, SDValue N0, SDValue N1,
55419
55418
/// Try to fold those constants into an 'add' instruction to reduce instruction
55420
55419
/// count. We do this with CMOV rather the generic 'select' because there are
55421
55420
/// earlier folds that may be used to turn select-of-constants into logic hacks.
55422
- static SDValue pushAddIntoCmovOfConsts(SDNode *N, SelectionDAG &DAG,
55421
+ static SDValue pushAddIntoCmovOfConsts(SDNode *N, const SDLoc &DL,
55422
+ SelectionDAG &DAG,
55423
55423
const X86Subtarget &Subtarget) {
55424
55424
// If an operand is zero, add-of-0 gets simplified away, so that's clearly
55425
55425
// better because we eliminate 1-2 instructions. This transform is still
@@ -55451,7 +55451,6 @@ static SDValue pushAddIntoCmovOfConsts(SDNode *N, SelectionDAG &DAG,
55451
55451
return SDValue();
55452
55452
55453
55453
EVT VT = N->getValueType(0);
55454
- SDLoc DL(N);
55455
55454
SDValue FalseOp = Cmov.getOperand(0);
55456
55455
SDValue TrueOp = Cmov.getOperand(1);
55457
55456
@@ -55492,7 +55491,7 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
55492
55491
SDValue Op1 = N->getOperand(1);
55493
55492
SDLoc DL(N);
55494
55493
55495
- if (SDValue Select = pushAddIntoCmovOfConsts(N, DAG, Subtarget))
55494
+ if (SDValue Select = pushAddIntoCmovOfConsts(N, DL, DAG, Subtarget))
55496
55495
return Select;
55497
55496
55498
55497
if (SDValue MAdd = matchPMADDWD(DAG, Op0, Op1, DL, VT, Subtarget))
@@ -55550,7 +55549,7 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
55550
55549
Op0.getOperand(0), Op0.getOperand(2));
55551
55550
}
55552
55551
55553
- return combineAddOrSubToADCOrSBB(N, DAG);
55552
+ return combineAddOrSubToADCOrSBB(N, DL, DAG);
55554
55553
}
55555
55554
55556
55555
// Try to fold (sub Y, cmovns X, -X) -> (add Y, cmovns -X, X) if the cmov
@@ -55626,6 +55625,7 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
55626
55625
const X86Subtarget &Subtarget) {
55627
55626
SDValue Op0 = N->getOperand(0);
55628
55627
SDValue Op1 = N->getOperand(1);
55628
+ SDLoc DL(N);
55629
55629
55630
55630
// TODO: Add NoOpaque handling to isConstantIntBuildVectorOrConstantInt.
55631
55631
auto IsNonOpaqueConstant = [&](SDValue Op) {
@@ -55645,7 +55645,6 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
55645
55645
if (Op1.getOpcode() == ISD::XOR && IsNonOpaqueConstant(Op0) &&
55646
55646
!isNullConstant(Op0) && IsNonOpaqueConstant(Op1.getOperand(1)) &&
55647
55647
Op1->hasOneUse()) {
55648
- SDLoc DL(N);
55649
55648
EVT VT = Op0.getValueType();
55650
55649
SDValue NewXor = DAG.getNode(ISD::XOR, SDLoc(Op1), VT, Op1.getOperand(0),
55651
55650
DAG.getNOT(SDLoc(Op1), Op1.getOperand(1), VT));
@@ -55676,14 +55675,14 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
55676
55675
assert(!Op1->hasAnyUseOfValue(1) && "Overflow bit in use");
55677
55676
SDValue ADC = DAG.getNode(X86ISD::ADC, SDLoc(Op1), Op1->getVTList(), Op0,
55678
55677
Op1.getOperand(1), Op1.getOperand(2));
55679
- return DAG.getNode(ISD::SUB, SDLoc(N) , Op0.getValueType(), ADC.getValue(0),
55678
+ return DAG.getNode(ISD::SUB, DL , Op0.getValueType(), ADC.getValue(0),
55680
55679
Op1.getOperand(0));
55681
55680
}
55682
55681
55683
- if (SDValue V = combineXorSubCTLZ(N, DAG, Subtarget))
55682
+ if (SDValue V = combineXorSubCTLZ(N, DL, DAG, Subtarget))
55684
55683
return V;
55685
55684
55686
- if (SDValue V = combineAddOrSubToADCOrSBB(N, DAG))
55685
+ if (SDValue V = combineAddOrSubToADCOrSBB(N, DL, DAG))
55687
55686
return V;
55688
55687
55689
55688
return combineSubSetcc(N, DAG);
0 commit comments