SDAG: Have SelectNodeTo replace uses if it CSE's instead of morphing a node

It's awkward to force callers of SelectNodeTo to figure out whether
the node was morphed or CSE'd. Update uses here instead of requiring
callers to (sometimes) do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269235 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner 2016-05-11 21:00:33 +00:00
parent 52af319151
commit cefd2c3002
2 changed files with 8 additions and 9 deletions

View File

@ -5942,10 +5942,14 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
SDVTList VTs,ArrayRef<SDValue> Ops) {
N = MorphNodeTo(N, ~MachineOpc, VTs, Ops);
SDNode *New = MorphNodeTo(N, ~MachineOpc, VTs, Ops);
// Reset the NodeID to -1.
N->setNodeId(-1);
return N;
New->setNodeId(-1);
if (New != N) {
ReplaceAllUsesWith(N, New);
RemoveDeadNode(N);
}
return New;
}
/// UpdadeSDLocOnMergedSDNode - If the opt level is -O0 then it throws away

View File

@ -2127,12 +2127,7 @@ void SelectionDAGISel::Select_WRITE_REGISTER(SDNode *Op) {
}
void SelectionDAGISel::Select_UNDEF(SDNode *N) {
SDNode *New =
CurDAG->SelectNodeTo(N, TargetOpcode::IMPLICIT_DEF, N->getValueType(0));
if (New != N) {
ReplaceUses(N, New);
CurDAG->RemoveDeadNode(N);
}
CurDAG->SelectNodeTo(N, TargetOpcode::IMPLICIT_DEF, N->getValueType(0));
}
/// GetVBR - decode a vbr encoding whose top bit is set.