summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2018-01-31 15:23:17 +0000
committerNirav Dave <niravd@google.com>2018-01-31 15:23:17 +0000
commitc3a1e16db1fed06ba707a3f6173ffbd805db36c6 (patch)
tree68cd8f7d76c77ef4c65702c9b1bce36e879c194b /llvm/lib
parent98f0021dd37d88bd6ff5b87caf3b01f0ebfb46a7 (diff)
downloadbcm5719-llvm-c3a1e16db1fed06ba707a3f6173ffbd805db36c6.tar.gz
bcm5719-llvm-c3a1e16db1fed06ba707a3f6173ffbd805db36c6.zip
[DAG] Prevent NodeId pruning of TokenFactors in Instruction Selection.
Summary: Instruction Selection preserves relative orders of all nodes save TokenFactors which we treat specially. As a result Node Ids for TokenFactors may violate the topological ordering and should not be considered as valid pruning candidates in predecessor search. Fixes PR35316. Reviewers: RKSimon, hfinkel Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D42701 llvm-svn: 323880
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index e90ec20bcdb..b3a316b93b4 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2157,7 +2157,9 @@ static bool findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse,
while (!WorkList.empty()) {
Use = WorkList.back();
WorkList.pop_back();
- if (Use->getNodeId() < Def->getNodeId() && Use->getNodeId() != -1)
+ // NodeId topological order of TokenFactors is not guaranteed. Do not skip.
+ if (Use->getOpcode() != ISD::TokenFactor &&
+ Use->getNodeId() < Def->getNodeId() && Use->getNodeId() != -1)
continue;
// Don't revisit nodes if we already scanned it and didn't fail, we know we
OpenPOWER on IntegriCloud