summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-06-01 20:55:26 +0000
committerJustin Bogner <mail@justinbogner.com>2016-06-01 20:55:26 +0000
commitf807dce6da05ef506b6a21b611f855f9eb209692 (patch)
treeaca8e4f3f7a68c9108a810fdc6ccef396559bf5f /llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
parent738ae45ce879da5126b99534207c24597522f5c8 (diff)
downloadbcm5719-llvm-f807dce6da05ef506b6a21b611f855f9eb209692.tar.gz
bcm5719-llvm-f807dce6da05ef506b6a21b611f855f9eb209692.zip
SDAG: Drop a redundant replace and move the dead node removal closer. NFC
llvm-svn: 271429
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 9a0fd6fba6c..bd0c992c4e9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2437,8 +2437,10 @@ MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTList,
// Otherwise, no replacement happened because the node already exists. Replace
// Uses of the old node with the new one.
- if (Res != Node)
+ if (Res != Node) {
CurDAG->ReplaceAllUsesWith(Node, Res);
+ CurDAG->RemoveDeadNode(Node);
+ }
return Res;
}
@@ -3436,11 +3438,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
// If this was a MorphNodeTo then we're completely done!
if (IsMorphNodeTo) {
// Update chain uses.
- UpdateChains(NodeToMatch, InputChain, ChainNodesMatched, true);
- if (Res != NodeToMatch) {
- ReplaceUses(NodeToMatch, Res);
- CurDAG->RemoveDeadNode(NodeToMatch);
- }
+ UpdateChains(Res, InputChain, ChainNodesMatched, true);
return;
}
continue;
OpenPOWER on IntegriCloud