[llvm] r346600 - [DAGCombiner] Make tryToFoldExtendOfConstant return an SDValue instead of an SDNode*. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 10 15:46:03 PST 2018
Author: ctopper
Date: Sat Nov 10 15:46:03 2018
New Revision: 346600
URL: http://llvm.org/viewvc/llvm-project?rev=346600&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=346600&r1=346599&r2=346600&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Nov 10 15:46:03 2018
@@ -8022,7 +8022,7 @@ SDValue DAGCombiner::visitSETCCCARRY(SDN
/// 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
// 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
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
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(SD
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(SD
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(SDN
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_VE
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_VE
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();
}
More information about the llvm-commits
mailing list