@@ -45385,15 +45385,14 @@ static SDValue combineToExtendBoolVectorInReg(
45385
45385
/// select to a bitwise logic operation.
45386
45386
/// TODO: Move to DAGCombiner, possibly using TargetLowering::hasAndNot()?
45387
45387
static SDValue
45388
- combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG,
45388
+ combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG, const SDLoc &DL,
45389
45389
TargetLowering::DAGCombinerInfo &DCI,
45390
45390
const X86Subtarget &Subtarget) {
45391
45391
SDValue Cond = N->getOperand(0);
45392
45392
SDValue LHS = N->getOperand(1);
45393
45393
SDValue RHS = N->getOperand(2);
45394
45394
EVT VT = LHS.getValueType();
45395
45395
EVT CondVT = Cond.getValueType();
45396
- SDLoc DL(N);
45397
45396
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
45398
45397
45399
45398
if (N->getOpcode() != ISD::VSELECT)
@@ -45491,7 +45490,7 @@ combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG,
45491
45490
/// and concatenate the result to eliminate a wide (256-bit) vector instruction:
45492
45491
/// vselect Cond, (concat T0, T1), (concat F0, F1) -->
45493
45492
/// concat (vselect (split Cond), T0, F0), (vselect (split Cond), T1, F1)
45494
- static SDValue narrowVectorSelect(SDNode *N, SelectionDAG &DAG,
45493
+ static SDValue narrowVectorSelect(SDNode *N, SelectionDAG &DAG, const SDLoc &DL,
45495
45494
const X86Subtarget &Subtarget) {
45496
45495
unsigned Opcode = N->getOpcode();
45497
45496
if (Opcode != X86ISD::BLENDV && Opcode != ISD::VSELECT)
@@ -45515,15 +45514,15 @@ static SDValue narrowVectorSelect(SDNode *N, SelectionDAG &DAG,
45515
45514
ArrayRef<SDValue> Ops) {
45516
45515
return DAG.getNode(Opcode, DL, Ops[1].getValueType(), Ops);
45517
45516
};
45518
- return SplitOpsAndApply(DAG, Subtarget, SDLoc(N) , VT, { Cond, TVal, FVal } ,
45519
- makeBlend, /*CheckBWI*/ false);
45517
+ return SplitOpsAndApply(DAG, Subtarget, DL , VT, {Cond, TVal, FVal}, makeBlend ,
45518
+ /*CheckBWI*/ false);
45520
45519
}
45521
45520
45522
- static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG) {
45521
+ static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG,
45522
+ const SDLoc &DL) {
45523
45523
SDValue Cond = N->getOperand(0);
45524
45524
SDValue LHS = N->getOperand(1);
45525
45525
SDValue RHS = N->getOperand(2);
45526
- SDLoc DL(N);
45527
45526
45528
45527
auto *TrueC = dyn_cast<ConstantSDNode>(LHS);
45529
45528
auto *FalseC = dyn_cast<ConstantSDNode>(RHS);
@@ -45597,6 +45596,7 @@ static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG) {
45597
45596
/// This function will also call SimplifyDemandedBits on already created
45598
45597
/// BLENDV to perform additional simplifications.
45599
45598
static SDValue combineVSelectToBLENDV(SDNode *N, SelectionDAG &DAG,
45599
+ const SDLoc &DL,
45600
45600
TargetLowering::DAGCombinerInfo &DCI,
45601
45601
const X86Subtarget &Subtarget) {
45602
45602
SDValue Cond = N->getOperand(0);
@@ -45681,8 +45681,8 @@ static SDValue combineVSelectToBLENDV(SDNode *N, SelectionDAG &DAG,
45681
45681
45682
45682
// Otherwise we can still at least try to simplify multiple use bits.
45683
45683
if (SDValue V = TLI.SimplifyMultipleUseDemandedBits(Cond, DemandedBits, DAG))
45684
- return DAG.getNode(X86ISD::BLENDV, SDLoc(N) , N->getValueType(0), V,
45685
- N->getOperand(1), N->getOperand(2));
45684
+ return DAG.getNode(X86ISD::BLENDV, DL , N->getValueType(0), V,
45685
+ N->getOperand(1), N->getOperand(2));
45686
45686
45687
45687
return SDValue();
45688
45688
}
@@ -45749,14 +45749,13 @@ static SDValue combineLogicBlendIntoConditionalNegate(
45749
45749
return DAG.getBitcast(VT, Res);
45750
45750
}
45751
45751
45752
- static SDValue commuteSelect(SDNode *N, SelectionDAG &DAG,
45753
- const X86Subtarget &Subtarget) {
45752
+ static SDValue commuteSelect(SDNode *N, SelectionDAG &DAG, const SDLoc &DL,
45753
+ const X86Subtarget &Subtarget) {
45754
45754
if (!Subtarget.hasAVX512())
45755
45755
return SDValue();
45756
45756
if (N->getOpcode() != ISD::VSELECT)
45757
45757
return SDValue();
45758
45758
45759
- SDLoc DL(N);
45760
45759
SDValue Cond = N->getOperand(0);
45761
45760
SDValue LHS = N->getOperand(1);
45762
45761
SDValue RHS = N->getOperand(2);
@@ -45798,7 +45797,7 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
45798
45797
// folded with mask instruction, while the rhs operand can't. Commute the
45799
45798
// lhs and rhs of the select instruction to create the opportunity of
45800
45799
// folding.
45801
- if (SDValue V = commuteSelect(N, DAG, Subtarget))
45800
+ if (SDValue V = commuteSelect(N, DAG, DL, Subtarget))
45802
45801
return V;
45803
45802
45804
45803
EVT VT = LHS.getValueType();
@@ -46080,7 +46079,7 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
46080
46079
}
46081
46080
}
46082
46081
46083
- if (SDValue V = combineSelectOfTwoConstants(N, DAG))
46082
+ if (SDValue V = combineSelectOfTwoConstants(N, DAG, DL ))
46084
46083
return V;
46085
46084
46086
46085
if (N->getOpcode() == ISD::SELECT && Cond.getOpcode() == ISD::SETCC &&
@@ -46222,13 +46221,13 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
46222
46221
if (!TLI.isTypeLegal(VT) || isSoftF16(VT, Subtarget))
46223
46222
return SDValue();
46224
46223
46225
- if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, DCI, Subtarget))
46224
+ if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, DL, DCI, Subtarget))
46226
46225
return V;
46227
46226
46228
- if (SDValue V = combineVSelectToBLENDV(N, DAG, DCI, Subtarget))
46227
+ if (SDValue V = combineVSelectToBLENDV(N, DAG, DL, DCI, Subtarget))
46229
46228
return V;
46230
46229
46231
- if (SDValue V = narrowVectorSelect(N, DAG, Subtarget))
46230
+ if (SDValue V = narrowVectorSelect(N, DAG, DL, Subtarget))
46232
46231
return V;
46233
46232
46234
46233
// select(~Cond, X, Y) -> select(Cond, Y, X)
0 commit comments