@@ -457,7 +457,7 @@ namespace {
457
457
SDValue visitAND(SDNode *N);
458
458
SDValue visitANDLike(SDValue N0, SDValue N1, SDNode *N);
459
459
SDValue visitOR(SDNode *N);
460
- SDValue visitORLike(SDValue N0, SDValue N1, SDNode *N );
460
+ SDValue visitORLike(SDValue N0, SDValue N1, const SDLoc &DL );
461
461
SDValue visitXOR(SDNode *N);
462
462
SDValue SimplifyVCastOp(SDNode *N, const SDLoc &DL);
463
463
SDValue SimplifyVBinOp(SDNode *N, const SDLoc &DL);
@@ -7566,9 +7566,8 @@ SDValue DAGCombiner::MatchBSwapHWord(SDNode *N, SDValue N0, SDValue N1) {
7566
7566
7567
7567
/// This contains all DAGCombine rules which reduce two values combined by
7568
7568
/// an Or operation to a single value \see visitANDLike().
7569
- SDValue DAGCombiner::visitORLike(SDValue N0, SDValue N1, SDNode *N ) {
7569
+ SDValue DAGCombiner::visitORLike(SDValue N0, SDValue N1, const SDLoc &DL ) {
7570
7570
EVT VT = N1.getValueType();
7571
- SDLoc DL(N);
7572
7571
7573
7572
// fold (or x, undef) -> -1
7574
7573
if (!LegalOperations && (N0.isUndef() || N1.isUndef()))
@@ -7702,23 +7701,24 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
7702
7701
SDValue N0 = N->getOperand(0);
7703
7702
SDValue N1 = N->getOperand(1);
7704
7703
EVT VT = N1.getValueType();
7704
+ SDLoc DL(N);
7705
7705
7706
7706
// x | x --> x
7707
7707
if (N0 == N1)
7708
7708
return N0;
7709
7709
7710
7710
// fold (or c1, c2) -> c1|c2
7711
- if (SDValue C = DAG.FoldConstantArithmetic(ISD::OR, SDLoc(N) , VT, {N0, N1}))
7711
+ if (SDValue C = DAG.FoldConstantArithmetic(ISD::OR, DL , VT, {N0, N1}))
7712
7712
return C;
7713
7713
7714
7714
// canonicalize constant to RHS
7715
7715
if (DAG.isConstantIntBuildVectorOrConstantInt(N0) &&
7716
7716
!DAG.isConstantIntBuildVectorOrConstantInt(N1))
7717
- return DAG.getNode(ISD::OR, SDLoc(N) , VT, N1, N0);
7717
+ return DAG.getNode(ISD::OR, DL , VT, N1, N0);
7718
7718
7719
7719
// fold vector ops
7720
7720
if (VT.isVector()) {
7721
- if (SDValue FoldedVOp = SimplifyVBinOp(N, SDLoc(N) ))
7721
+ if (SDValue FoldedVOp = SimplifyVBinOp(N, DL ))
7722
7722
return FoldedVOp;
7723
7723
7724
7724
// fold (or x, 0) -> x, vector edition
@@ -7728,7 +7728,7 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
7728
7728
// fold (or x, -1) -> -1, vector edition
7729
7729
if (ISD::isConstantSplatVectorAllOnes(N1.getNode()))
7730
7730
// do not return N1, because undef node may exist in N1
7731
- return DAG.getAllOnesConstant(SDLoc(N) , N1.getValueType());
7731
+ return DAG.getAllOnesConstant(DL , N1.getValueType());
7732
7732
7733
7733
// fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask)
7734
7734
// Do this only if the resulting type / shuffle is legal.
@@ -7778,10 +7778,8 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
7778
7778
if (CanFold) {
7779
7779
SDValue NewLHS = ZeroN00 ? N0.getOperand(1) : N0.getOperand(0);
7780
7780
SDValue NewRHS = ZeroN10 ? N1.getOperand(1) : N1.getOperand(0);
7781
-
7782
7781
SDValue LegalShuffle =
7783
- TLI.buildLegalVectorShuffle(VT, SDLoc(N), NewLHS, NewRHS,
7784
- Mask, DAG);
7782
+ TLI.buildLegalVectorShuffle(VT, DL, NewLHS, NewRHS, Mask, DAG);
7785
7783
if (LegalShuffle)
7786
7784
return LegalShuffle;
7787
7785
}
@@ -7808,7 +7806,7 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
7808
7806
if (SDValue R = foldAndOrOfSETCC(N, DAG))
7809
7807
return R;
7810
7808
7811
- if (SDValue Combined = visitORLike(N0, N1, N ))
7809
+ if (SDValue Combined = visitORLike(N0, N1, DL ))
7812
7810
return Combined;
7813
7811
7814
7812
if (SDValue Combined = combineCarryDiamond(DAG, TLI, N0, N1, N))
@@ -7821,12 +7819,12 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
7821
7819
return BSwap;
7822
7820
7823
7821
// reassociate or
7824
- if (SDValue ROR = reassociateOps(ISD::OR, SDLoc(N) , N0, N1, N->getFlags()))
7822
+ if (SDValue ROR = reassociateOps(ISD::OR, DL , N0, N1, N->getFlags()))
7825
7823
return ROR;
7826
7824
7827
7825
// Fold or(vecreduce(x), vecreduce(y)) -> vecreduce(or(x, y))
7828
- if (SDValue SD = reassociateReduction(ISD::VECREDUCE_OR, ISD::OR, SDLoc(N),
7829
- VT, N0, N1))
7826
+ if (SDValue SD =
7827
+ reassociateReduction(ISD::VECREDUCE_OR, ISD::OR, DL, VT, N0, N1))
7830
7828
return SD;
7831
7829
7832
7830
// Canonicalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2)
@@ -7840,7 +7838,7 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
7840
7838
{N1, N0.getOperand(1)})) {
7841
7839
SDValue IOR = DAG.getNode(ISD::OR, SDLoc(N0), VT, N0.getOperand(0), N1);
7842
7840
AddToWorklist(IOR.getNode());
7843
- return DAG.getNode(ISD::AND, SDLoc(N) , VT, COR, IOR);
7841
+ return DAG.getNode(ISD::AND, DL , VT, COR, IOR);
7844
7842
}
7845
7843
}
7846
7844
@@ -7855,7 +7853,7 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
7855
7853
return V;
7856
7854
7857
7855
// See if this is some rotate idiom.
7858
- if (SDValue Rot = MatchRotate(N0, N1, SDLoc(N) ))
7856
+ if (SDValue Rot = MatchRotate(N0, N1, DL ))
7859
7857
return Rot;
7860
7858
7861
7859
if (SDValue Load = MatchLoadCombine(N))
@@ -11534,7 +11532,7 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
11534
11532
N2_2, Flags);
11535
11533
}
11536
11534
// Otherwise see if we can optimize to a better pattern.
11537
- if (SDValue Combined = visitORLike(N0, N2_0, N ))
11535
+ if (SDValue Combined = visitORLike(N0, N2_0, DL ))
11538
11536
return DAG.getNode(ISD::SELECT, DL, N1.getValueType(), Combined, N1,
11539
11537
N2_2, Flags);
11540
11538
}
0 commit comments