Skip to content

Commit 2e271ce

Browse files
committed
Revert 4fef8c7 "[X86] splitVectorOp - share the same SDLoc argument instead of recreating it over and over again."
This appears to have broken the clang-with-thin-lto-ubuntu buildbot somehow (unconfirmed but its a likely candidate)
1 parent 7252d22 commit 2e271ce

File tree

1 file changed

+45
-50
lines changed

1 file changed

+45
-50
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4070,9 +4070,10 @@ static std::pair<SDValue, SDValue> splitVector(SDValue Op, SelectionDAG &DAG,
40704070
}
40714071

40724072
/// Break an operation into 2 half sized ops and then concatenate the results.
4073-
static SDValue splitVectorOp(SDValue Op, SelectionDAG &DAG, const SDLoc &dl) {
4073+
static SDValue splitVectorOp(SDValue Op, SelectionDAG &DAG) {
40744074
unsigned NumOps = Op.getNumOperands();
40754075
EVT VT = Op.getValueType();
4076+
SDLoc dl(Op);
40764077

40774078
// Extract the LHS Lo/Hi vectors
40784079
SmallVector<SDValue> LoOps(NumOps, SDValue());
@@ -4095,8 +4096,7 @@ static SDValue splitVectorOp(SDValue Op, SelectionDAG &DAG, const SDLoc &dl) {
40954096

40964097
/// Break an unary integer operation into 2 half sized ops and then
40974098
/// concatenate the result back.
4098-
static SDValue splitVectorIntUnary(SDValue Op, SelectionDAG &DAG,
4099-
const SDLoc &dl) {
4099+
static SDValue splitVectorIntUnary(SDValue Op, SelectionDAG &DAG) {
41004100
// Make sure we only try to split 256/512-bit types to avoid creating
41014101
// narrow vectors.
41024102
EVT VT = Op.getValueType();
@@ -4107,20 +4107,19 @@ static SDValue splitVectorIntUnary(SDValue Op, SelectionDAG &DAG,
41074107
assert(Op.getOperand(0).getValueType().getVectorNumElements() ==
41084108
VT.getVectorNumElements() &&
41094109
"Unexpected VTs!");
4110-
return splitVectorOp(Op, DAG, dl);
4110+
return splitVectorOp(Op, DAG);
41114111
}
41124112

41134113
/// Break a binary integer operation into 2 half sized ops and then
41144114
/// concatenate the result back.
4115-
static SDValue splitVectorIntBinary(SDValue Op, SelectionDAG &DAG,
4116-
const SDLoc &dl) {
4115+
static SDValue splitVectorIntBinary(SDValue Op, SelectionDAG &DAG) {
41174116
// Assert that all the types match.
41184117
EVT VT = Op.getValueType();
41194118
(void)VT;
41204119
assert(Op.getOperand(0).getValueType() == VT &&
41214120
Op.getOperand(1).getValueType() == VT && "Unexpected VTs!");
41224121
assert((VT.is256BitVector() || VT.is512BitVector()) && "Unsupported VT!");
4123-
return splitVectorOp(Op, DAG, dl);
4122+
return splitVectorOp(Op, DAG);
41244123
}
41254124

41264125
// Helper for splitting operands of an operation to legal target size and
@@ -20055,7 +20054,7 @@ static SDValue LowerAVXExtend(SDValue Op, SelectionDAG &DAG,
2005520054

2005620055
if (VT == MVT::v32i16 && !Subtarget.hasBWI()) {
2005720056
assert(InVT == MVT::v32i8 && "Unexpected VT!");
20058-
return splitVectorIntUnary(Op, DAG, dl);
20057+
return splitVectorIntUnary(Op, DAG);
2005920058
}
2006020059

2006120060
if (Subtarget.hasInt256())
@@ -20636,7 +20635,7 @@ SDValue X86TargetLowering::LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const {
2063620635
if (Subtarget.hasAVX512()) {
2063720636
if (InVT == MVT::v32i16 && !Subtarget.hasBWI()) {
2063820637
assert(VT == MVT::v32i8 && "Unexpected VT!");
20639-
return splitVectorIntUnary(Op, DAG, DL);
20638+
return splitVectorIntUnary(Op, DAG);
2064020639
}
2064120640

2064220641
// word to byte only under BWI. Otherwise we have to promoted to v16i32
@@ -21616,8 +21615,7 @@ SDValue X86TargetLowering::LowerFP_TO_BF16(SDValue Op,
2161621615

2161721616
/// Depending on uarch and/or optimizing for size, we might prefer to use a
2161821617
/// vector operation in place of the typical scalar operation.
21619-
static SDValue lowerAddSubToHorizontalOp(SDValue Op, const SDLoc &DL,
21620-
SelectionDAG &DAG,
21618+
static SDValue lowerAddSubToHorizontalOp(SDValue Op, SelectionDAG &DAG,
2162121619
const X86Subtarget &Subtarget) {
2162221620
// If both operands have other uses, this is probably not profitable.
2162321621
SDValue LHS = Op.getOperand(0);
@@ -21673,6 +21671,7 @@ static SDValue lowerAddSubToHorizontalOp(SDValue Op, const SDLoc &DL,
2167321671

2167421672
// Creating a 256-bit horizontal op would be wasteful, and there is no 512-bit
2167521673
// equivalent, so extract the 256/512-bit source op to 128-bit if we can.
21674+
SDLoc DL(Op);
2167621675
if (BitWidth == 256 || BitWidth == 512) {
2167721676
unsigned LaneIdx = LExtIndex / NumEltsPerLane;
2167821677
X = extract128BitVector(X, LaneIdx * NumEltsPerLane, DAG, DL);
@@ -21693,7 +21692,7 @@ static SDValue lowerAddSubToHorizontalOp(SDValue Op, const SDLoc &DL,
2169321692
SDValue X86TargetLowering::lowerFaddFsub(SDValue Op, SelectionDAG &DAG) const {
2169421693
assert((Op.getValueType() == MVT::f32 || Op.getValueType() == MVT::f64) &&
2169521694
"Only expecting float/double");
21696-
return lowerAddSubToHorizontalOp(Op, SDLoc(Op), DAG, Subtarget);
21695+
return lowerAddSubToHorizontalOp(Op, DAG, Subtarget);
2169721696
}
2169821697

2169921698
/// ISD::FROUND is defined to round to nearest with ties rounding away from 0.
@@ -24450,7 +24449,7 @@ static SDValue LowerSIGN_EXTEND(SDValue Op, const X86Subtarget &Subtarget,
2445024449

2445124450
if (VT == MVT::v32i16 && !Subtarget.hasBWI()) {
2445224451
assert(InVT == MVT::v32i8 && "Unexpected VT!");
24453-
return splitVectorIntUnary(Op, DAG, dl);
24452+
return splitVectorIntUnary(Op, DAG);
2445424453
}
2445524454

2445624455
if (Subtarget.hasInt256())
@@ -27813,7 +27812,7 @@ static SDValue LowerVectorCTLZ_AVX512CDI(SDValue Op, SelectionDAG &DAG,
2781327812
// Split vector, it's Lo and Hi parts will be handled in next iteration.
2781427813
if (NumElems > 16 ||
2781527814
(NumElems == 16 && !Subtarget.canExtendTo512DQ()))
27816-
return splitVectorIntUnary(Op, DAG, dl);
27815+
return splitVectorIntUnary(Op, DAG);
2781727816

2781827817
MVT NewVT = MVT::getVectorVT(MVT::i32, NumElems);
2781927818
assert((NewVT.is256BitVector() || NewVT.is512BitVector()) &&
@@ -27923,11 +27922,11 @@ static SDValue LowerVectorCTLZ(SDValue Op, const SDLoc &DL,
2792327922

2792427923
// Decompose 256-bit ops into smaller 128-bit ops.
2792527924
if (VT.is256BitVector() && !Subtarget.hasInt256())
27926-
return splitVectorIntUnary(Op, DAG, DL);
27925+
return splitVectorIntUnary(Op, DAG);
2792727926

2792827927
// Decompose 512-bit ops into smaller 256-bit ops.
2792927928
if (VT.is512BitVector() && !Subtarget.hasBWI())
27930-
return splitVectorIntUnary(Op, DAG, DL);
27929+
return splitVectorIntUnary(Op, DAG);
2793127930

2793227931
assert(Subtarget.hasSSSE3() && "Expected SSSE3 support for PSHUFB");
2793327932
return LowerVectorCTLZInRegLUT(Op, DL, Subtarget, DAG);
@@ -28000,18 +27999,16 @@ static SDValue LowerCTTZ(SDValue Op, const X86Subtarget &Subtarget,
2800027999
static SDValue lowerAddSub(SDValue Op, SelectionDAG &DAG,
2800128000
const X86Subtarget &Subtarget) {
2800228001
MVT VT = Op.getSimpleValueType();
28003-
SDLoc DL(Op);
28004-
2800528002
if (VT == MVT::i16 || VT == MVT::i32)
28006-
return lowerAddSubToHorizontalOp(Op, DL, DAG, Subtarget);
28003+
return lowerAddSubToHorizontalOp(Op, DAG, Subtarget);
2800728004

2800828005
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28009-
return splitVectorIntBinary(Op, DAG, DL);
28006+
return splitVectorIntBinary(Op, DAG);
2801028007

2801128008
assert(Op.getSimpleValueType().is256BitVector() &&
2801228009
Op.getSimpleValueType().isInteger() &&
2801328010
"Only handle AVX 256-bit vector integer operation");
28014-
return splitVectorIntBinary(Op, DAG, DL);
28011+
return splitVectorIntBinary(Op, DAG);
2801528012
}
2801628013

2801728014
static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
@@ -28025,7 +28022,7 @@ static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
2802528022
(VT.is256BitVector() && !Subtarget.hasInt256())) {
2802628023
assert(Op.getSimpleValueType().isInteger() &&
2802728024
"Only handle AVX vector integer operation");
28028-
return splitVectorIntBinary(Op, DAG, DL);
28025+
return splitVectorIntBinary(Op, DAG);
2802928026
}
2803028027

2803128028
// Avoid the generic expansion with min/max if we don't have pminu*/pmaxu*.
@@ -28087,11 +28084,10 @@ static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
2808728084
static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
2808828085
SelectionDAG &DAG) {
2808928086
MVT VT = Op.getSimpleValueType();
28090-
SDLoc DL(Op);
28091-
2809228087
if (VT == MVT::i16 || VT == MVT::i32 || VT == MVT::i64) {
2809328088
// Since X86 does not have CMOV for 8-bit integer, we don't convert
2809428089
// 8-bit integer abs to NEG and CMOV.
28090+
SDLoc DL(Op);
2809528091
SDValue N0 = Op.getOperand(0);
2809628092
SDValue Neg = DAG.getNode(X86ISD::SUB, DL, DAG.getVTList(VT, MVT::i32),
2809728093
DAG.getConstant(0, DL, VT), N0);
@@ -28102,6 +28098,7 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
2810228098

2810328099
// ABS(vXi64 X) --> VPBLENDVPD(X, 0-X, X).
2810428100
if ((VT == MVT::v2i64 || VT == MVT::v4i64) && Subtarget.hasSSE41()) {
28101+
SDLoc DL(Op);
2810528102
SDValue Src = Op.getOperand(0);
2810628103
SDValue Sub =
2810728104
DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT), Src);
@@ -28111,11 +28108,11 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
2811128108
if (VT.is256BitVector() && !Subtarget.hasInt256()) {
2811228109
assert(VT.isInteger() &&
2811328110
"Only handle AVX 256-bit vector integer operation");
28114-
return splitVectorIntUnary(Op, DAG, DL);
28111+
return splitVectorIntUnary(Op, DAG);
2811528112
}
2811628113

2811728114
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28118-
return splitVectorIntUnary(Op, DAG, DL);
28115+
return splitVectorIntUnary(Op, DAG);
2811928116

2812028117
// Default to expand.
2812128118
return SDValue();
@@ -28124,14 +28121,13 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
2812428121
static SDValue LowerAVG(SDValue Op, const X86Subtarget &Subtarget,
2812528122
SelectionDAG &DAG) {
2812628123
MVT VT = Op.getSimpleValueType();
28127-
SDLoc DL(Op);
2812828124

2812928125
// For AVX1 cases, split to use legal ops.
2813028126
if (VT.is256BitVector() && !Subtarget.hasInt256())
28131-
return splitVectorIntBinary(Op, DAG, DL);
28127+
return splitVectorIntBinary(Op, DAG);
2813228128

2813328129
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28134-
return splitVectorIntBinary(Op, DAG, DL);
28130+
return splitVectorIntBinary(Op, DAG);
2813528131

2813628132
// Default to expand.
2813728133
return SDValue();
@@ -28140,14 +28136,13 @@ static SDValue LowerAVG(SDValue Op, const X86Subtarget &Subtarget,
2814028136
static SDValue LowerMINMAX(SDValue Op, const X86Subtarget &Subtarget,
2814128137
SelectionDAG &DAG) {
2814228138
MVT VT = Op.getSimpleValueType();
28143-
SDLoc DL(Op);
2814428139

2814528140
// For AVX1 cases, split to use legal ops.
2814628141
if (VT.is256BitVector() && !Subtarget.hasInt256())
28147-
return splitVectorIntBinary(Op, DAG, DL);
28142+
return splitVectorIntBinary(Op, DAG);
2814828143

2814928144
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28150-
return splitVectorIntBinary(Op, DAG, DL);
28145+
return splitVectorIntBinary(Op, DAG);
2815128146

2815228147
// Default to expand.
2815328148
return SDValue();
@@ -28304,15 +28299,15 @@ static SDValue LowerFMINIMUM_FMAXIMUM(SDValue Op, const X86Subtarget &Subtarget,
2830428299
static SDValue LowerABD(SDValue Op, const X86Subtarget &Subtarget,
2830528300
SelectionDAG &DAG) {
2830628301
MVT VT = Op.getSimpleValueType();
28307-
SDLoc dl(Op);
2830828302

2830928303
// For AVX1 cases, split to use legal ops.
2831028304
if (VT.is256BitVector() && !Subtarget.hasInt256())
28311-
return splitVectorIntBinary(Op, DAG, dl);
28305+
return splitVectorIntBinary(Op, DAG);
2831228306

2831328307
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.useBWIRegs())
28314-
return splitVectorIntBinary(Op, DAG, dl);
28308+
return splitVectorIntBinary(Op, DAG);
2831528309

28310+
SDLoc dl(Op);
2831628311
bool IsSigned = Op.getOpcode() == ISD::ABDS;
2831728312
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
2831828313

@@ -28355,10 +28350,10 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget,
2835528350

2835628351
// Decompose 256-bit ops into 128-bit ops.
2835728352
if (VT.is256BitVector() && !Subtarget.hasInt256())
28358-
return splitVectorIntBinary(Op, DAG, dl);
28353+
return splitVectorIntBinary(Op, DAG);
2835928354

2836028355
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28361-
return splitVectorIntBinary(Op, DAG, dl);
28356+
return splitVectorIntBinary(Op, DAG);
2836228357

2836328358
SDValue A = Op.getOperand(0);
2836428359
SDValue B = Op.getOperand(1);
@@ -28581,10 +28576,10 @@ static SDValue LowerMULH(SDValue Op, const X86Subtarget &Subtarget,
2858128576

2858228577
// Decompose 256-bit ops into 128-bit ops.
2858328578
if (VT.is256BitVector() && !Subtarget.hasInt256())
28584-
return splitVectorIntBinary(Op, DAG, dl);
28579+
return splitVectorIntBinary(Op, DAG);
2858528580

2858628581
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28587-
return splitVectorIntBinary(Op, DAG, dl);
28582+
return splitVectorIntBinary(Op, DAG);
2858828583

2858928584
if (VT == MVT::v4i32 || VT == MVT::v8i32 || VT == MVT::v16i32) {
2859028585
assert((VT == MVT::v4i32 && Subtarget.hasSSE2()) ||
@@ -29762,10 +29757,10 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
2976229757

2976329758
// Decompose 256-bit shifts into 128-bit shifts.
2976429759
if (VT.is256BitVector())
29765-
return splitVectorIntBinary(Op, DAG, dl);
29760+
return splitVectorIntBinary(Op, DAG);
2976629761

2976729762
if (VT == MVT::v32i16 || VT == MVT::v64i8)
29768-
return splitVectorIntBinary(Op, DAG, dl);
29763+
return splitVectorIntBinary(Op, DAG);
2976929764

2977029765
return SDValue();
2977129766
}
@@ -29842,7 +29837,7 @@ static SDValue LowerFunnelShift(SDValue Op, const X86Subtarget &Subtarget,
2984229837
EltSizeInBits < 32)) {
2984329838
// Pre-mask the amount modulo using the wider vector.
2984429839
Op = DAG.getNode(Op.getOpcode(), DL, VT, Op0, Op1, AmtMod);
29845-
return splitVectorOp(Op, DAG, DL);
29840+
return splitVectorOp(Op, DAG);
2984629841
}
2984729842

2984829843
// Attempt to fold scalar shift as unpack(y,x) << zext(splat(z))
@@ -30004,7 +29999,7 @@ static SDValue LowerRotate(SDValue Op, const X86Subtarget &Subtarget,
3000429999

3000530000
// Split 256-bit integers on XOP/pre-AVX2 targets.
3000630001
if (VT.is256BitVector() && (Subtarget.hasXOP() || !Subtarget.hasAVX2()))
30007-
return splitVectorIntBinary(Op, DAG, DL);
30002+
return splitVectorIntBinary(Op, DAG);
3000830003

3000930004
// XOP has 128-bit vector variable + immediate rotates.
3001030005
// +ve/-ve Amt = rotate left/right - just need to handle ISD::ROTL.
@@ -30040,7 +30035,7 @@ static SDValue LowerRotate(SDValue Op, const X86Subtarget &Subtarget,
3004030035

3004130036
// Split 512-bit integers on non 512-bit BWI targets.
3004230037
if (VT.is512BitVector() && !Subtarget.useBWIRegs())
30043-
return splitVectorIntBinary(Op, DAG, DL);
30038+
return splitVectorIntBinary(Op, DAG);
3004430039

3004530040
assert(
3004630041
(VT == MVT::v4i32 || VT == MVT::v8i16 || VT == MVT::v16i8 ||
@@ -31120,11 +31115,11 @@ static SDValue LowerVectorCTPOP(SDValue Op, const SDLoc &DL,
3112031115

3112131116
// Decompose 256-bit ops into smaller 128-bit ops.
3112231117
if (VT.is256BitVector() && !Subtarget.hasInt256())
31123-
return splitVectorIntUnary(Op, DAG, DL);
31118+
return splitVectorIntUnary(Op, DAG);
3112431119

3112531120
// Decompose 512-bit ops into smaller 256-bit ops.
3112631121
if (VT.is512BitVector() && !Subtarget.hasBWI())
31127-
return splitVectorIntUnary(Op, DAG, DL);
31122+
return splitVectorIntUnary(Op, DAG);
3112831123

3112931124
// For element types greater than i8, do vXi8 pop counts and a bytesum.
3113031125
if (VT.getScalarType() != MVT::i8) {
@@ -31248,7 +31243,7 @@ static SDValue LowerBITREVERSE_XOP(SDValue Op, SelectionDAG &DAG) {
3124831243

3124931244
// Decompose 256-bit ops into smaller 128-bit ops.
3125031245
if (VT.is256BitVector())
31251-
return splitVectorIntUnary(Op, DAG, DL);
31246+
return splitVectorIntUnary(Op, DAG);
3125231247

3125331248
assert(VT.is128BitVector() &&
3125431249
"Only 128-bit vector bitreverse lowering supported.");
@@ -31287,11 +31282,11 @@ static SDValue LowerBITREVERSE(SDValue Op, const X86Subtarget &Subtarget,
3128731282

3128831283
// Split 512-bit ops without BWI so that we can still use the PSHUFB lowering.
3128931284
if (VT.is512BitVector() && !Subtarget.hasBWI())
31290-
return splitVectorIntUnary(Op, DAG, DL);
31285+
return splitVectorIntUnary(Op, DAG);
3129131286

3129231287
// Decompose 256-bit ops into smaller 128-bit ops on pre-AVX2.
3129331288
if (VT.is256BitVector() && !Subtarget.hasInt256())
31294-
return splitVectorIntUnary(Op, DAG, DL);
31289+
return splitVectorIntUnary(Op, DAG);
3129531290

3129631291
// Lower vXi16/vXi32/vXi64 as BSWAP + vXi8 BITREVERSE.
3129731292
if (VT.getScalarType() != MVT::i8) {
@@ -55938,7 +55933,7 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
5593855933
if (isConcatenatedNot(InVecBC.getOperand(0)) ||
5593955934
isConcatenatedNot(InVecBC.getOperand(1))) {
5594055935
// extract (and v4i64 X, (not (concat Y1, Y2))), n -> andnp v2i64 X(n), Y1
55941-
SDValue Concat = splitVectorIntBinary(InVecBC, DAG, SDLoc(InVecBC));
55936+
SDValue Concat = splitVectorIntBinary(InVecBC, DAG);
5594255937
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT,
5594355938
DAG.getBitcast(InVecVT, Concat), N->getOperand(1));
5594455939
}

0 commit comments

Comments
 (0)