forked from OSchip/llvm-project
SDAG: Drop a redundant replace and move the dead node removal closer. NFC
llvm-svn: 271429
This commit is contained in:
parent
738ae45ce8
commit
f807dce6da
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue