mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[DAGCombiner] Make tryToFoldExtendOfConstant return an SDValue instead of an SDNode*. NFC
Removes the need to call getNode internally and to recreate an SDValue after the call. llvm-svn: 346600
This commit is contained in:
parent
421c124b54
commit
bc019cf120
@ -8022,7 +8022,7 @@ SDValue DAGCombiner::visitSETCCCARRY(SDNode *N) {
|
||||
/// dag nodes (see for example method DAGCombiner::visitSIGN_EXTEND).
|
||||
/// Vector extends are not folded if operations are legal; this is to
|
||||
/// avoid introducing illegal build_vector dag nodes.
|
||||
static SDNode *tryToFoldExtendOfConstant(SDNode *N, const TargetLowering &TLI,
|
||||
static SDValue tryToFoldExtendOfConstant(SDNode *N, const TargetLowering &TLI,
|
||||
SelectionDAG &DAG, bool LegalTypes,
|
||||
bool LegalOperations) {
|
||||
unsigned Opcode = N->getOpcode();
|
||||
@ -8038,7 +8038,7 @@ static SDNode *tryToFoldExtendOfConstant(SDNode *N, const TargetLowering &TLI,
|
||||
// fold (zext c1) -> c1
|
||||
// fold (aext c1) -> c1
|
||||
if (isa<ConstantSDNode>(N0))
|
||||
return DAG.getNode(Opcode, SDLoc(N), VT, N0).getNode();
|
||||
return DAG.getNode(Opcode, SDLoc(N), VT, N0);
|
||||
|
||||
// fold (sext (build_vector AllConstants) -> (build_vector AllConstants)
|
||||
// fold (zext (build_vector AllConstants) -> (build_vector AllConstants)
|
||||
@ -8047,7 +8047,7 @@ static SDNode *tryToFoldExtendOfConstant(SDNode *N, const TargetLowering &TLI,
|
||||
if (!(VT.isVector() &&
|
||||
(!LegalTypes || (!LegalOperations && TLI.isTypeLegal(SVT))) &&
|
||||
ISD::isBuildVectorOfConstantSDNodes(N0.getNode())))
|
||||
return nullptr;
|
||||
return SDValue();
|
||||
|
||||
// We can fold this node into a build_vector.
|
||||
unsigned VTBits = SVT.getSizeInBits();
|
||||
@ -8073,7 +8073,7 @@ static SDNode *tryToFoldExtendOfConstant(SDNode *N, const TargetLowering &TLI,
|
||||
Elts.push_back(DAG.getConstant(C.zext(VTBits), DL, SVT));
|
||||
}
|
||||
|
||||
return DAG.getBuildVector(VT, DL, Elts).getNode();
|
||||
return DAG.getBuildVector(VT, DL, Elts);
|
||||
}
|
||||
|
||||
// ExtendUsesToFormExtLoad - Trying to extend uses of a load to enable this:
|
||||
@ -8479,9 +8479,9 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
|
||||
EVT VT = N->getValueType(0);
|
||||
SDLoc DL(N);
|
||||
|
||||
if (SDNode *Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
LegalOperations))
|
||||
return SDValue(Res, 0);
|
||||
return Res;
|
||||
|
||||
// fold (sext (sext x)) -> (sext x)
|
||||
// fold (sext (aext x)) -> (sext x)
|
||||
@ -8718,9 +8718,9 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
|
||||
SDValue N0 = N->getOperand(0);
|
||||
EVT VT = N->getValueType(0);
|
||||
|
||||
if (SDNode *Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
LegalOperations))
|
||||
return SDValue(Res, 0);
|
||||
return Res;
|
||||
|
||||
// fold (zext (zext x)) -> (zext x)
|
||||
// fold (zext (aext x)) -> (zext x)
|
||||
@ -8968,9 +8968,9 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
|
||||
SDValue N0 = N->getOperand(0);
|
||||
EVT VT = N->getValueType(0);
|
||||
|
||||
if (SDNode *Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
LegalOperations))
|
||||
return SDValue(Res, 0);
|
||||
return Res;
|
||||
|
||||
// fold (aext (aext x)) -> (aext x)
|
||||
// fold (aext (zext x)) -> (zext x)
|
||||
@ -9495,9 +9495,9 @@ SDValue DAGCombiner::visitSIGN_EXTEND_VECTOR_INREG(SDNode *N) {
|
||||
if (N0.isUndef())
|
||||
return DAG.getUNDEF(VT);
|
||||
|
||||
if (SDNode *Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
LegalOperations))
|
||||
return SDValue(Res, 0);
|
||||
return Res;
|
||||
|
||||
return SDValue();
|
||||
}
|
||||
@ -9509,9 +9509,9 @@ SDValue DAGCombiner::visitZERO_EXTEND_VECTOR_INREG(SDNode *N) {
|
||||
if (N0.isUndef())
|
||||
return DAG.getUNDEF(VT);
|
||||
|
||||
if (SDNode *Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes,
|
||||
LegalOperations))
|
||||
return SDValue(Res, 0);
|
||||
return Res;
|
||||
|
||||
return SDValue();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user