SDAG: Drop a redundant replace and move the dead node removal closer. NFC

llvm-svn: 271429
This commit is contained in:
Justin Bogner 2016-06-01 20:55:26 +00:00
parent 738ae45ce8
commit f807dce6da
1 changed files with 4 additions and 6 deletions

View File

@ -2437,8 +2437,10 @@ MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTList,
// Otherwise, no replacement happened because the node already exists. Replace // Otherwise, no replacement happened because the node already exists. Replace
// Uses of the old node with the new one. // Uses of the old node with the new one.
if (Res != Node) if (Res != Node) {
CurDAG->ReplaceAllUsesWith(Node, Res); CurDAG->ReplaceAllUsesWith(Node, Res);
CurDAG->RemoveDeadNode(Node);
}
return Res; return Res;
} }
@ -3436,11 +3438,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
// If this was a MorphNodeTo then we're completely done! // If this was a MorphNodeTo then we're completely done!
if (IsMorphNodeTo) { if (IsMorphNodeTo) {
// Update chain uses. // Update chain uses.
UpdateChains(NodeToMatch, InputChain, ChainNodesMatched, true); UpdateChains(Res, InputChain, ChainNodesMatched, true);
if (Res != NodeToMatch) {
ReplaceUses(NodeToMatch, Res);
CurDAG->RemoveDeadNode(NodeToMatch);
}
return; return;
} }
continue; continue;