summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2018-02-01 16:11:59 +0000
committerNirav Dave <niravd@google.com>2018-02-01 16:11:59 +0000
commit18f7f60e1758cf8e47eb5b06ee7b3e04159c4415 (patch)
treef5188c2145a72a312be315754f71e527a4b16768 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
parent9c6e2fd5a4d37df0cf82486e0648583650b297f9 (diff)
downloadbcm5719-llvm-18f7f60e1758cf8e47eb5b06ee7b3e04159c4415.tar.gz
bcm5719-llvm-18f7f60e1758cf8e47eb5b06ee7b3e04159c4415.zip
[SelectionDAG] Fix UpdateChains handling of TokenFactors
Summary: In Instruction Selection UpdateChains replaces all matched Nodes' chain references including interior token factors and deletes them. This may allow nodes which depend on these interior nodes but are not part of the set of matched nodes to be left with a dangling dependence. Avoid this by doing the replacement for matched non-TokenFactor nodes. Fixes PR36164. Reviewers: jonpa, RKSimon, bogner Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D42754 llvm-svn: 323977
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index b3a316b93b4..ab0a2293666 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2365,7 +2365,8 @@ void SelectionDAGISel::UpdateChains(
std::replace(ChainNodesMatched.begin(), ChainNodesMatched.end(), N,
static_cast<SDNode *>(nullptr));
});
- CurDAG->ReplaceAllUsesOfValueWith(ChainVal, InputChain);
+ if (ChainNode->getOpcode() != ISD::TokenFactor)
+ CurDAG->ReplaceAllUsesOfValueWith(ChainVal, InputChain);
// If the node became dead and we haven't already seen it, delete it.
if (ChainNode != NodeToMatch && ChainNode->use_empty() &&
OpenPOWER on IntegriCloud