diff options
author | Justin Bogner <mail@justinbogner.com> | 2016-05-11 21:00:33 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2016-05-11 21:00:33 +0000 |
commit | b3534c494ff3380d6a30fbb2a6c265cad2efcaec (patch) | |
tree | 0f2a2a2626add8242638fcc4229ea2e45eaec8b1 /llvm/lib/CodeGen | |
parent | 29ebd4979a1ab2e400bb16be1fc59af3b2f86c7e (diff) | |
download | bcm5719-llvm-b3534c494ff3380d6a30fbb2a6c265cad2efcaec.tar.gz bcm5719-llvm-b3534c494ff3380d6a30fbb2a6c265cad2efcaec.zip |
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
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 7 |
2 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 5a61708b651..f2a38d7a3af 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -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 diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 6bb5060f5bb..9a0fd6fba6c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -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. |