forked from OSchip/llvm-project
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. llvm-svn: 269235
This commit is contained in:
parent
29ebd4979a
commit
b3534c494f
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue