diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-07-26 05:52:51 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-07-26 05:52:51 +0000 |
commit | 98655fa4d8205b72fd4b032f899f1f09c25245d7 (patch) | |
tree | e5e7434dc23721a24bd499b48549e35a705dcd05 /llvm/lib/CodeGen | |
parent | 411fb407f8458bd51a123ee10f37cd67b04da08a (diff) | |
download | bcm5719-llvm-98655fa4d8205b72fd4b032f899f1f09c25245d7.tar.gz bcm5719-llvm-98655fa4d8205b72fd4b032f899f1f09c25245d7.zip |
[SDAG] Simplify the code for handling single-value nodes and add
a missing transfer of debug information (without which tests fail).
llvm-svn: 214021
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index a5ff5f9f299..96e569e7b64 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1344,15 +1344,19 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) { // a complete mess. SDValue Res = TLI.LowerOperation(SDValue(Node, 0), DAG); if (Res.getNode()) { - SmallVector<SDValue, 8> ResultVals; - for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) { - if (e == 1) - ResultVals.push_back(Res); - else - ResultVals.push_back(Res.getValue(i)); + if (!(Res.getNode() != Node || Res.getResNo() != 0)) + return; + + if (Node->getNumValues() == 1) { + // We can just directly replace this node with the lowered value. + ReplaceNode(SDValue(Node, 0), Res); + return; } - if (Res.getNode() != Node || Res.getResNo() != 0) - ReplaceNode(Node, ResultVals.data()); + + SmallVector<SDValue, 8> ResultVals; + for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) + ResultVals.push_back(Res.getValue(i)); + ReplaceNode(Node, ResultVals.data()); return; } } |