summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2017-04-14 09:17:09 +0000
committerAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2017-04-14 09:17:09 +0000
commit4e7bcd5216afb5e380fe21bfa7401253d9046138 (patch)
tree81c8331001e95200b8d70ee7ee072a1971e17805 /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent1a1678e7eb6ee3a865c7bdc2d07f37c8d2c08ef4 (diff)
downloadbcm5719-llvm-4e7bcd5216afb5e380fe21bfa7401253d9046138.tar.gz
bcm5719-llvm-4e7bcd5216afb5e380fe21bfa7401253d9046138.zip
Fix for PR#30562: Selection DAG error: Detected cycle in SelectionDAG.
Patch by Dinar Temirbulatov llvm-svn: 300314
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index b7378b36021..fc7cd020fe2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1192,8 +1192,11 @@ SDValue SelectionDAGLegalize::ExpandExtractFromVectorThroughStack(SDValue Op) {
// If the index is dependent on the store we will introduce a cycle when
// creating the load (the load uses the index, and by replacing the chain
- // we will make the index dependent on the load).
- if (SDNode::hasPredecessorHelper(ST, Visited, Worklist))
+ // we will make the index dependent on the load). Also, the store might be
+ // dependent on the extractelement and introduce a cycle when creating
+ // the load.
+ if (SDNode::hasPredecessorHelper(ST, Visited, Worklist) ||
+ ST->hasPredecessor(Op.getNode()))
continue;
StackPtr = ST->getBasePtr();
OpenPOWER on IntegriCloud