Skip to content

Commit 4fac145

Browse files
committed
[X86] combineSelect - reuse existing SDLoc. NFC.
1 parent ba8792b commit 4fac145

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45385,15 +45385,14 @@ static SDValue combineToExtendBoolVectorInReg(
4538545385
/// select to a bitwise logic operation.
4538645386
/// TODO: Move to DAGCombiner, possibly using TargetLowering::hasAndNot()?
4538745387
static SDValue
45388-
combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG,
45388+
combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG, const SDLoc &DL,
4538945389
TargetLowering::DAGCombinerInfo &DCI,
4539045390
const X86Subtarget &Subtarget) {
4539145391
SDValue Cond = N->getOperand(0);
4539245392
SDValue LHS = N->getOperand(1);
4539345393
SDValue RHS = N->getOperand(2);
4539445394
EVT VT = LHS.getValueType();
4539545395
EVT CondVT = Cond.getValueType();
45396-
SDLoc DL(N);
4539745396
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
4539845397

4539945398
if (N->getOpcode() != ISD::VSELECT)
@@ -45491,7 +45490,7 @@ combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG,
4549145490
/// and concatenate the result to eliminate a wide (256-bit) vector instruction:
4549245491
/// vselect Cond, (concat T0, T1), (concat F0, F1) -->
4549345492
/// 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,
4549545494
const X86Subtarget &Subtarget) {
4549645495
unsigned Opcode = N->getOpcode();
4549745496
if (Opcode != X86ISD::BLENDV && Opcode != ISD::VSELECT)
@@ -45515,15 +45514,15 @@ static SDValue narrowVectorSelect(SDNode *N, SelectionDAG &DAG,
4551545514
ArrayRef<SDValue> Ops) {
4551645515
return DAG.getNode(Opcode, DL, Ops[1].getValueType(), Ops);
4551745516
};
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);
4552045519
}
4552145520

45522-
static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG) {
45521+
static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG,
45522+
const SDLoc &DL) {
4552345523
SDValue Cond = N->getOperand(0);
4552445524
SDValue LHS = N->getOperand(1);
4552545525
SDValue RHS = N->getOperand(2);
45526-
SDLoc DL(N);
4552745526

4552845527
auto *TrueC = dyn_cast<ConstantSDNode>(LHS);
4552945528
auto *FalseC = dyn_cast<ConstantSDNode>(RHS);
@@ -45597,6 +45596,7 @@ static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG) {
4559745596
/// This function will also call SimplifyDemandedBits on already created
4559845597
/// BLENDV to perform additional simplifications.
4559945598
static SDValue combineVSelectToBLENDV(SDNode *N, SelectionDAG &DAG,
45599+
const SDLoc &DL,
4560045600
TargetLowering::DAGCombinerInfo &DCI,
4560145601
const X86Subtarget &Subtarget) {
4560245602
SDValue Cond = N->getOperand(0);
@@ -45681,8 +45681,8 @@ static SDValue combineVSelectToBLENDV(SDNode *N, SelectionDAG &DAG,
4568145681

4568245682
// Otherwise we can still at least try to simplify multiple use bits.
4568345683
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));
4568645686

4568745687
return SDValue();
4568845688
}
@@ -45749,14 +45749,13 @@ static SDValue combineLogicBlendIntoConditionalNegate(
4574945749
return DAG.getBitcast(VT, Res);
4575045750
}
4575145751

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) {
4575445754
if (!Subtarget.hasAVX512())
4575545755
return SDValue();
4575645756
if (N->getOpcode() != ISD::VSELECT)
4575745757
return SDValue();
4575845758

45759-
SDLoc DL(N);
4576045759
SDValue Cond = N->getOperand(0);
4576145760
SDValue LHS = N->getOperand(1);
4576245761
SDValue RHS = N->getOperand(2);
@@ -45798,7 +45797,7 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
4579845797
// folded with mask instruction, while the rhs operand can't. Commute the
4579945798
// lhs and rhs of the select instruction to create the opportunity of
4580045799
// folding.
45801-
if (SDValue V = commuteSelect(N, DAG, Subtarget))
45800+
if (SDValue V = commuteSelect(N, DAG, DL, Subtarget))
4580245801
return V;
4580345802

4580445803
EVT VT = LHS.getValueType();
@@ -46080,7 +46079,7 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
4608046079
}
4608146080
}
4608246081

46083-
if (SDValue V = combineSelectOfTwoConstants(N, DAG))
46082+
if (SDValue V = combineSelectOfTwoConstants(N, DAG, DL))
4608446083
return V;
4608546084

4608646085
if (N->getOpcode() == ISD::SELECT && Cond.getOpcode() == ISD::SETCC &&
@@ -46222,13 +46221,13 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
4622246221
if (!TLI.isTypeLegal(VT) || isSoftF16(VT, Subtarget))
4622346222
return SDValue();
4622446223

46225-
if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, DCI, Subtarget))
46224+
if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, DL, DCI, Subtarget))
4622646225
return V;
4622746226

46228-
if (SDValue V = combineVSelectToBLENDV(N, DAG, DCI, Subtarget))
46227+
if (SDValue V = combineVSelectToBLENDV(N, DAG, DL, DCI, Subtarget))
4622946228
return V;
4623046229

46231-
if (SDValue V = narrowVectorSelect(N, DAG, Subtarget))
46230+
if (SDValue V = narrowVectorSelect(N, DAG, DL, Subtarget))
4623246231
return V;
4623346232

4623446233
// select(~Cond, X, Y) -> select(Cond, Y, X)

0 commit comments

Comments
 (0)