diff options
author | Nirav Dave <niravd@google.com> | 2018-03-22 19:32:07 +0000 |
---|---|---|
committer | Nirav Dave <niravd@google.com> | 2018-03-22 19:32:07 +0000 |
commit | 8c5f47ac406c817a3bbf1f17281b1a6bbfe7be89 (patch) | |
tree | a3509534a5cb4c84c11e212e0e065ad46766401a /llvm/lib/Target/SystemZ | |
parent | 308e39ca8d89f9b9891fe70b4c47c458a53871d4 (diff) | |
download | bcm5719-llvm-8c5f47ac406c817a3bbf1f17281b1a6bbfe7be89.tar.gz bcm5719-llvm-8c5f47ac406c817a3bbf1f17281b1a6bbfe7be89.zip |
[DAG, X86] Fix ISel-time node insertion ids
As in SystemZ backend, correctly propagate node ids when inserting new
unselected nodes into the DAG during instruction Seleciton for X86
target.
Fixes PR36865.
Reviewers: jyknight, craig.topper
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D44797
llvm-svn: 328233
Diffstat (limited to 'llvm/lib/Target/SystemZ')
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp index 6e2130828bb..59dd46c0697 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp @@ -593,16 +593,16 @@ bool SystemZDAGToDAGISel::selectAddress(SDValue Addr, // The selection DAG must no longer depend on their uniqueness when this // function is used. static void insertDAGNode(SelectionDAG *DAG, SDNode *Pos, SDValue N) { - if (N.getNode()->getNodeId() == -1 || - N.getNode()->getNodeId() > Pos->getNodeId()) { + if (N->getNodeId() == -1 || + (SelectionDAGISel::getUninvalidatedNodeId(N.getNode()) > + SelectionDAGISel::getUninvalidatedNodeId(Pos))) { DAG->RepositionNode(Pos->getIterator(), N.getNode()); // Mark Node as invalid for pruning as after this it may be a successor to a // selected node but otherwise be in the same position of Pos. // Conservatively mark it with the same -abs(Id) to assure node id // invariant is preserved. - int PId = Pos->getNodeId(); - int InvalidatedPId = -(PId + 1); - N->setNodeId((PId > 0) ? InvalidatedPId : PId); + N->setNodeId(Pos->getNodeId()); + SelectionDAGISel::InvalidateNodeId(N.getNode()); } } |