Skip to content

Commit

Permalink
[X86] Remove what appear to be unnecessary uses of DCI.CombineTo
Browse files Browse the repository at this point in the history
CombineTo is most useful when you need to replace multiple results, avoid the worklist management, or you need to something else after the combine, etc. Otherwise you should be able to just return the new node and let DAGCombiner go through its usual worklist code.

All of the places changed in this patch look to be standard cases where we should be able to use the more stand behavior of just returning the new node.

Differential Revision: https://reviews.llvm.org/D49569

llvm-svn: 337589
  • Loading branch information
topperc committed Jul 20, 2018
1 parent a219bae commit 6194ccf
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30830,7 +30830,7 @@ static SDValue combineTargetShuffle(SDValue N, SelectionDAG &DAG,

// Nuke no-op shuffles that show up after combining.
if (isNoopShuffleMask(Mask))
return DCI.CombineTo(N.getNode(), N.getOperand(0), /*AddTo*/ true);
return N.getOperand(0);

// Look for simplifications involving one or two shuffle instructions.
SDValue V = N.getOperand(0);
Expand Down Expand Up @@ -31286,9 +31286,8 @@ static SDValue combineShuffle(SDNode *N, SelectionDAG &DAG,
// a particular chain.
if (SDValue Res = combineX86ShufflesRecursively(
{Op}, 0, Op, {0}, {}, /*Depth*/ 1,
/*HasVarMask*/ false, DAG, Subtarget)) {
return DCI.CombineTo(N, Res);
}
/*HasVarMask*/ false, DAG, Subtarget))
return Res;
}

return SDValue();
Expand Down Expand Up @@ -34259,9 +34258,8 @@ static SDValue combineVectorPack(SDNode *N, SelectionDAG &DAG,
SDValue Op(N, 0);
if (SDValue Res =
combineX86ShufflesRecursively({Op}, 0, Op, {0}, {}, /*Depth*/ 1,
/*HasVarMask*/ false, DAG, Subtarget)) {
return DCI.CombineTo(N, Res);
}
/*HasVarMask*/ false, DAG, Subtarget))
return Res;

return SDValue();
}
Expand Down Expand Up @@ -34320,9 +34318,8 @@ static SDValue combineVectorShiftImm(SDNode *N, SelectionDAG &DAG,
SDValue Op(N, 0);
if (SDValue Res = combineX86ShufflesRecursively(
{Op}, 0, Op, {0}, {}, /*Depth*/ 1,
/*HasVarMask*/ false, DAG, Subtarget)) {
return DCI.CombineTo(N, Res);
}
/*HasVarMask*/ false, DAG, Subtarget))
return Res;
}

// Constant Folding.
Expand Down Expand Up @@ -34360,9 +34357,8 @@ static SDValue combineVectorInsert(SDNode *N, SelectionDAG &DAG,
SDValue Op(N, 0);
if (SDValue Res =
combineX86ShufflesRecursively({Op}, 0, Op, {0}, {}, /*Depth*/ 1,
/*HasVarMask*/ false, DAG, Subtarget)) {
return DCI.CombineTo(N, Res);
}
/*HasVarMask*/ false, DAG, Subtarget))
return Res;

return SDValue();
}
Expand Down Expand Up @@ -34816,9 +34812,8 @@ static SDValue combineAnd(SDNode *N, SelectionDAG &DAG,
SDValue Op(N, 0);
if (SDValue Res = combineX86ShufflesRecursively(
{Op}, 0, Op, {0}, {}, /*Depth*/ 1,
/*HasVarMask*/ false, DAG, Subtarget)) {
return DCI.CombineTo(N, Res);
}
/*HasVarMask*/ false, DAG, Subtarget))
return Res;
}

// Attempt to combine a scalar bitmask AND with an extracted shuffle.
Expand Down Expand Up @@ -37226,9 +37221,8 @@ static SDValue combineAndnp(SDNode *N, SelectionDAG &DAG,
SDValue Op(N, 0);
if (SDValue Res = combineX86ShufflesRecursively(
{Op}, 0, Op, {0}, {}, /*Depth*/ 1,
/*HasVarMask*/ false, DAG, Subtarget)) {
return DCI.CombineTo(N, Res);
}
/*HasVarMask*/ false, DAG, Subtarget))
return Res;
}

return SDValue();
Expand Down

0 comments on commit 6194ccf

Please sign in to comment.