@@ -6764,34 +6764,34 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
6764
6764
SDValue N0 = N->getOperand(0);
6765
6765
SDValue N1 = N->getOperand(1);
6766
6766
EVT VT = N1.getValueType();
6767
+ SDLoc DL(N);
6767
6768
6768
6769
// x & x --> x
6769
6770
if (N0 == N1)
6770
6771
return N0;
6771
6772
6772
6773
// fold (and c1, c2) -> c1&c2
6773
- if (SDValue C = DAG.FoldConstantArithmetic(ISD::AND, SDLoc(N) , VT, {N0, N1}))
6774
+ if (SDValue C = DAG.FoldConstantArithmetic(ISD::AND, DL , VT, {N0, N1}))
6774
6775
return C;
6775
6776
6776
6777
// canonicalize constant to RHS
6777
6778
if (DAG.isConstantIntBuildVectorOrConstantInt(N0) &&
6778
6779
!DAG.isConstantIntBuildVectorOrConstantInt(N1))
6779
- return DAG.getNode(ISD::AND, SDLoc(N) , VT, N1, N0);
6780
+ return DAG.getNode(ISD::AND, DL , VT, N1, N0);
6780
6781
6781
6782
if (areBitwiseNotOfEachother(N0, N1))
6782
- return DAG.getConstant(APInt::getZero(VT.getScalarSizeInBits()), SDLoc(N),
6783
- VT);
6783
+ return DAG.getConstant(APInt::getZero(VT.getScalarSizeInBits()), DL, VT);
6784
6784
6785
6785
// fold vector ops
6786
6786
if (VT.isVector()) {
6787
- if (SDValue FoldedVOp = SimplifyVBinOp(N, SDLoc(N) ))
6787
+ if (SDValue FoldedVOp = SimplifyVBinOp(N, DL ))
6788
6788
return FoldedVOp;
6789
6789
6790
6790
// fold (and x, 0) -> 0, vector edition
6791
6791
if (ISD::isConstantSplatVectorAllZeros(N1.getNode()))
6792
6792
// do not return N1, because undef node may exist in N1
6793
- return DAG.getConstant(APInt::getZero(N1.getScalarValueSizeInBits()),
6794
- SDLoc(N), N1.getValueType());
6793
+ return DAG.getConstant(APInt::getZero(N1.getScalarValueSizeInBits()), DL,
6794
+ N1.getValueType());
6795
6795
6796
6796
// fold (and x, -1) -> x, vector edition
6797
6797
if (ISD::isConstantSplatVectorAllOnes(N1.getNode()))
@@ -6811,8 +6811,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
6811
6811
uint64_t ElementSize =
6812
6812
LoadVT.getVectorElementType().getScalarSizeInBits();
6813
6813
if (Splat->getAPIntValue().isMask(ElementSize)) {
6814
- auto NewLoad = DAG.getMaskedLoad(
6815
- ExtVT, SDLoc(N) , MLoad->getChain(), MLoad->getBasePtr(),
6814
+ SDValue NewLoad = DAG.getMaskedLoad(
6815
+ ExtVT, DL , MLoad->getChain(), MLoad->getBasePtr(),
6816
6816
MLoad->getOffset(), MLoad->getMask(), MLoad->getPassThru(),
6817
6817
LoadVT, MLoad->getMemOperand(), MLoad->getAddressingMode(),
6818
6818
ISD::ZEXTLOAD, MLoad->isExpandingLoad());
@@ -6834,7 +6834,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
6834
6834
unsigned BitWidth = VT.getScalarSizeInBits();
6835
6835
ConstantSDNode *N1C = isConstOrConstSplat(N1);
6836
6836
if (N1C && DAG.MaskedValueIsZero(SDValue(N, 0), APInt::getAllOnes(BitWidth)))
6837
- return DAG.getConstant(0, SDLoc(N) , VT);
6837
+ return DAG.getConstant(0, DL , VT);
6838
6838
6839
6839
if (SDValue R = foldAndOrOfSETCC(N, DAG))
6840
6840
return R;
@@ -6843,12 +6843,12 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
6843
6843
return NewSel;
6844
6844
6845
6845
// reassociate and
6846
- if (SDValue RAND = reassociateOps(ISD::AND, SDLoc(N) , N0, N1, N->getFlags()))
6846
+ if (SDValue RAND = reassociateOps(ISD::AND, DL , N0, N1, N->getFlags()))
6847
6847
return RAND;
6848
6848
6849
6849
// Fold and(vecreduce(x), vecreduce(y)) -> vecreduce(and(x, y))
6850
- if (SDValue SD = reassociateReduction(ISD::VECREDUCE_AND, ISD::AND, SDLoc(N),
6851
- VT, N0, N1))
6850
+ if (SDValue SD =
6851
+ reassociateReduction(ISD::VECREDUCE_AND, ISD::AND, DL, VT, N0, N1))
6852
6852
return SD;
6853
6853
6854
6854
// fold (and (or x, C), D) -> D if (C & D) == D
@@ -6868,18 +6868,16 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
6868
6868
6869
6869
// fold (and (any_ext V), c) -> (zero_ext V) if 'and' only clears top bits.
6870
6870
if (DAG.MaskedValueIsZero(N0Op0, Mask))
6871
- return DAG.getNode(ISD::ZERO_EXTEND, SDLoc(N) , VT, N0Op0);
6871
+ return DAG.getNode(ISD::ZERO_EXTEND, DL , VT, N0Op0);
6872
6872
6873
6873
// fold (and (any_ext V), c) -> (zero_ext (and (trunc V), c)) if profitable.
6874
6874
if (N1C->getAPIntValue().countLeadingZeros() >= (BitWidth - SrcBitWidth) &&
6875
6875
TLI.isTruncateFree(VT, SrcVT) && TLI.isZExtFree(SrcVT, VT) &&
6876
6876
TLI.isTypeDesirableForOp(ISD::AND, SrcVT) &&
6877
- TLI.isNarrowingProfitable(VT, SrcVT)) {
6878
- SDLoc DL(N);
6877
+ TLI.isNarrowingProfitable(VT, SrcVT))
6879
6878
return DAG.getNode(ISD::ZERO_EXTEND, DL, VT,
6880
6879
DAG.getNode(ISD::AND, DL, SrcVT, N0Op0,
6881
6880
DAG.getZExtOrTrunc(N1, DL, SrcVT)));
6882
- }
6883
6881
}
6884
6882
6885
6883
// fold (and (ext (and V, c1)), c2) -> (and (ext V), (and c1, (ext c2)))
@@ -6891,7 +6889,6 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
6891
6889
DAG.isConstantIntBuildVectorOrConstantInt(N1) &&
6892
6890
DAG.isConstantIntBuildVectorOrConstantInt(N0Op0.getOperand(1)) &&
6893
6891
N0->hasOneUse() && N0Op0->hasOneUse()) {
6894
- SDLoc DL(N);
6895
6892
SDValue NewMask =
6896
6893
DAG.getNode(ISD::AND, DL, VT, N1,
6897
6894
DAG.getNode(ExtOpc, DL, VT, N0Op0.getOperand(1)));
@@ -6912,8 +6909,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
6912
6909
N0.getOperand(0).getOpcode() == ISD::LOAD &&
6913
6910
N0.getOperand(0).getResNo() == 0) ||
6914
6911
(N0.getOpcode() == ISD::LOAD && N0.getResNo() == 0)) {
6915
- LoadSDNode *Load = cast<LoadSDNode>( (N0.getOpcode() == ISD::LOAD) ?
6916
- N0 : N0.getOperand(0) );
6912
+ auto *Load =
6913
+ cast<LoadSDNode>((N0.getOpcode() == ISD::LOAD) ? N0 : N0.getOperand(0));
6917
6914
6918
6915
// Get the constant (if applicable) the zero'th operand is being ANDed with.
6919
6916
// This can be a pure constant or a vector splat, in which case we treat the
@@ -7023,9 +7020,9 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
7023
7020
// (and (extract_subvector (zext|anyext|sext v) _) iN_mask)
7024
7021
// => (extract_subvector (iN_zeroext v))
7025
7022
SDValue ZeroExtExtendee =
7026
- DAG.getNode(ISD::ZERO_EXTEND, SDLoc(N) , ExtVT, Extendee);
7023
+ DAG.getNode(ISD::ZERO_EXTEND, DL , ExtVT, Extendee);
7027
7024
7028
- return DAG.getNode(ISD::EXTRACT_SUBVECTOR, SDLoc(N) , VT, ZeroExtExtendee,
7025
+ return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL , VT, ZeroExtExtendee,
7029
7026
N0.getOperand(1));
7030
7027
}
7031
7028
}
@@ -7042,8 +7039,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
7042
7039
GN0->getBasePtr(), GN0->getIndex(), GN0->getScale()};
7043
7040
7044
7041
SDValue ZExtLoad = DAG.getMaskedGather(
7045
- DAG.getVTList(VT, MVT::Other), MemVT, SDLoc(N) , Ops,
7046
- GN0->getMemOperand(), GN0-> getIndexType(), ISD::ZEXTLOAD);
7042
+ DAG.getVTList(VT, MVT::Other), MemVT, DL , Ops, GN0->getMemOperand() ,
7043
+ GN0->getIndexType(), ISD::ZEXTLOAD);
7047
7044
7048
7045
CombineTo(N, ZExtLoad);
7049
7046
AddToWorklist(ZExtLoad.getNode());
@@ -7095,7 +7092,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
7095
7092
return SubRHS;
7096
7093
if (SubRHS.getOpcode() == ISD::SIGN_EXTEND &&
7097
7094
SubRHS.getOperand(0).getScalarValueSizeInBits() == 1)
7098
- return DAG.getNode(ISD::ZERO_EXTEND, SDLoc(N) , VT, SubRHS.getOperand(0));
7095
+ return DAG.getNode(ISD::ZERO_EXTEND, DL , VT, SubRHS.getOperand(0));
7099
7096
}
7100
7097
}
7101
7098
@@ -7109,7 +7106,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
7109
7106
if (ISD::isUNINDEXEDLoad(N0.getNode()) &&
7110
7107
(ISD::isEXTLoad(N0.getNode()) ||
7111
7108
(ISD::isSEXTLoad(N0.getNode()) && N0.hasOneUse()))) {
7112
- LoadSDNode *LN0 = cast<LoadSDNode>(N0);
7109
+ auto *LN0 = cast<LoadSDNode>(N0);
7113
7110
EVT MemVT = LN0->getMemoryVT();
7114
7111
// If we zero all the possible extended bits, then we can turn this into
7115
7112
// a zextload if we are running before legalize or the operation is legal.
@@ -7164,7 +7161,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
7164
7161
7165
7162
// Replace (and (sign_extend ...) #bitmask) with (zero_extend ...).
7166
7163
if (IsAndZeroExtMask(N0, N1))
7167
- return DAG.getNode(ISD::ZERO_EXTEND, SDLoc(N) , VT, N0.getOperand(0));
7164
+ return DAG.getNode(ISD::ZERO_EXTEND, DL , VT, N0.getOperand(0));
7168
7165
7169
7166
if (hasOperation(ISD::USUBSAT, VT))
7170
7167
if (SDValue V = foldAndToUsubsat(N, DAG))
0 commit comments