Skip to content

Commit 5a896c6

Browse files
committed
[X86] Merge repeated getTargetLoweringInfo() calls. NFC.
1 parent f53c2f6 commit 5a896c6

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7200,6 +7200,7 @@ static SDValue lowerBuildVectorAsBroadcast(BuildVectorSDNode *BVOp,
72007200

72017201
MVT VT = BVOp->getSimpleValueType(0);
72027202
unsigned NumElts = VT.getVectorNumElements();
7203+
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
72037204
assert((VT.is128BitVector() || VT.is256BitVector() || VT.is512BitVector()) &&
72047205
"Unsupported vector type for broadcast.");
72057206

@@ -7265,7 +7266,6 @@ static SDValue lowerBuildVectorAsBroadcast(BuildVectorSDNode *BVOp,
72657266
if (isFoldableUseOfShuffle(BVOp))
72667267
return SDValue();
72677268
// replace BUILD_VECTOR with broadcast of the repeated constants.
7268-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
72697269
LLVMContext *Ctx = DAG.getContext();
72707270
MVT PVT = TLI.getPointerTy(DAG.getDataLayout());
72717271
if (SplatBitSize == 32 || SplatBitSize == 64 ||
@@ -7363,7 +7363,6 @@ static SDValue lowerBuildVectorAsBroadcast(BuildVectorSDNode *BVOp,
73637363

73647364
assert(C && "Invalid constant type");
73657365

7366-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
73677366
SDValue CP =
73687367
DAG.getConstantPool(C, TLI.getPointerTy(DAG.getDataLayout()));
73697368
Align Alignment = cast<ConstantPoolSDNode>(CP)->getAlign();
@@ -38219,6 +38218,7 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
3821938218

3822038219
unsigned NumMaskElts = Mask.size();
3822138220
unsigned MaskEltSizeInBits = RootSizeInBits / NumMaskElts;
38221+
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
3822238222

3822338223
// Determine the effective mask value type.
3822438224
FloatDomain &= (32 <= MaskEltSizeInBits);
@@ -38227,7 +38227,7 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
3822738227
MaskVT = MVT::getVectorVT(MaskVT, NumMaskElts);
3822838228

3822938229
// Only allow legal mask types.
38230-
if (!DAG.getTargetLoweringInfo().isTypeLegal(MaskVT))
38230+
if (!TLI.isTypeLegal(MaskVT))
3823138231
return SDValue();
3823238232

3823338233
// Attempt to match the mask against known shuffle patterns.
@@ -38533,7 +38533,7 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
3853338533
// which is much simpler than any shuffle.
3853438534
if (UnaryShuffle && MaskContainsZeros && AllowVariablePerLaneMask &&
3853538535
isSequentialOrUndefOrZeroInRange(Mask, 0, NumMaskElts, 0) &&
38536-
DAG.getTargetLoweringInfo().isTypeLegal(MaskVT)) {
38536+
TLI.isTypeLegal(MaskVT)) {
3853738537
APInt Zero = APInt::getZero(MaskEltSizeInBits);
3853838538
APInt AllOnes = APInt::getAllOnes(MaskEltSizeInBits);
3853938539
APInt UndefElts(NumMaskElts, 0);
@@ -40073,6 +40073,7 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4007340073
MVT VT = N.getSimpleValueType();
4007440074
SmallVector<int, 4> Mask;
4007540075
unsigned Opcode = N.getOpcode();
40076+
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
4007640077

4007740078
if (SDValue R = combineCommutableSHUFP(N, VT, DL, DAG))
4007840079
return R;
@@ -40124,7 +40125,7 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4012440125
// 32-bit targets have to bitcast i64 to f64, so better to bitcast upward.
4012540126
if (Src.getOpcode() == ISD::BITCAST &&
4012640127
SrcVT.getScalarSizeInBits() == BCVT.getScalarSizeInBits() &&
40127-
DAG.getTargetLoweringInfo().isTypeLegal(BCVT) &&
40128+
TLI.isTypeLegal(BCVT) &&
4012840129
FixedVectorType::isValidElementType(
4012940130
BCVT.getScalarType().getTypeForEVT(*DAG.getContext()))) {
4013040131
EVT NewVT = EVT::getVectorVT(*DAG.getContext(), BCVT.getScalarType(),
@@ -40162,8 +40163,7 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4016240163
isNullConstant(Src.getOperand(1)) &&
4016340164
Src.getValueType() ==
4016440165
Src.getOperand(0).getValueType().getScalarType() &&
40165-
DAG.getTargetLoweringInfo().isTypeLegal(
40166-
Src.getOperand(0).getValueType()))
40166+
TLI.isTypeLegal(Src.getOperand(0).getValueType()))
4016740167
return DAG.getNode(X86ISD::VBROADCAST, DL, VT, Src.getOperand(0));
4016840168

4016940169
// Share broadcast with the longest vector and extract low subvector (free).
@@ -40377,7 +40377,7 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4037740377
ConstantVec[0] = const_cast<ConstantInt *>(C->getConstantIntValue());
4037840378

4037940379
// Load the vector constant from constant pool.
40380-
MVT PVT = DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout());
40380+
MVT PVT = TLI.getPointerTy(DAG.getDataLayout());
4038140381
SDValue CP = DAG.getConstantPool(ConstantVector::get(ConstantVec), PVT);
4038240382
MachinePointerInfo MPI =
4038340383
MachinePointerInfo::getConstantPool(DAG.getMachineFunction());
@@ -44555,7 +44555,6 @@ static SDValue combineExtractVectorElt(SDNode *N, SelectionDAG &DAG,
4455544555
if (LoadVec && CIdx && ISD::isNormalLoad(LoadVec) && VT.isInteger() &&
4455644556
SrcVT.getVectorElementType() == VT && DCI.isAfterLegalizeDAG() &&
4455744557
!LikelyUsedAsVector && LoadVec->isSimple()) {
44558-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
4455944558
SDValue NewPtr =
4456044559
TLI.getVectorElementPointer(DAG, LoadVec->getBasePtr(), SrcVT, EltIdx);
4456144560
unsigned PtrOff = VT.getSizeInBits() * CIdx->getZExtValue() / 8;
@@ -45957,6 +45956,7 @@ static SDValue combinePTESTCC(SDValue EFLAGS, X86::CondCode &CC,
4595745956
SDValue Op0 = EFLAGS.getOperand(0);
4595845957
SDValue Op1 = EFLAGS.getOperand(1);
4595945958
MVT OpVT = Op0.getSimpleValueType();
45959+
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
4596045960

4596145961
// TEST*(~X,Y) == TEST*(X,Y)
4596245962
if (SDValue NotOp0 = IsNOT(Op0, DAG)) {
@@ -46040,12 +46040,11 @@ static SDValue combinePTESTCC(SDValue EFLAGS, X86::CondCode &CC,
4604046040
// TODO: Handle TESTC with comparison inversion.
4604146041
// TODO: Can we remove SimplifyMultipleUseDemandedBits and rely on
4604246042
// TESTP/MOVMSK combines to make sure its never worse than PTEST?
46043-
if (BCVT.isVector() && DAG.getTargetLoweringInfo().isTypeLegal(BCVT)) {
46043+
if (BCVT.isVector() && TLI.isTypeLegal(BCVT)) {
4604446044
unsigned EltBits = BCVT.getScalarSizeInBits();
4604546045
if (DAG.ComputeNumSignBits(BC) == EltBits) {
4604646046
assert(VT == MVT::i32 && "Expected i32 EFLAGS comparison result");
4604746047
APInt SignMask = APInt::getSignMask(EltBits);
46048-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
4604946048
if (SDValue Res =
4605046049
TLI.SimplifyMultipleUseDemandedBits(BC, SignMask, DAG)) {
4605146050
// For vXi16 cases we need to use pmovmksb and extract every other
@@ -53605,6 +53604,7 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
5360553604
SDValue Index = GorS->getIndex();
5360653605
SDValue Base = GorS->getBasePtr();
5360753606
SDValue Scale = GorS->getScale();
53607+
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
5360853608

5360953609
if (DCI.isBeforeLegalize()) {
5361053610
unsigned IndexWidth = Index.getScalarValueSizeInBits();
@@ -53639,7 +53639,6 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
5363953639
}
5364053640
}
5364153641

53642-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
5364353642
EVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
5364453643
// Try to move splat constant adders from the index operand to the base
5364553644
// pointer operand. Taking care to multiply by the scale. We can only do
@@ -53696,7 +53695,6 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
5369653695
// With vector masks we only demand the upper bit of the mask.
5369753696
SDValue Mask = GorS->getMask();
5369853697
if (Mask.getScalarValueSizeInBits() != 1) {
53699-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
5370053698
APInt DemandedMask(APInt::getSignMask(Mask.getScalarValueSizeInBits()));
5370153699
if (TLI.SimplifyDemandedBits(Mask, DemandedMask, DCI)) {
5370253700
if (N->getOpcode() != ISD::DELETED_NODE)

0 commit comments

Comments
 (0)