summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-04-26 21:48:25 +0000
committerAndrew Trick <atrick@apple.com>2012-04-26 21:48:25 +0000
commitaec9240be2bc0bc852167b26fd2e217355ecd745 (patch)
treefd7c533f08b919cda9e45923caa503ef8266794c /lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
parent06e950ecb21514b0d09f942c108ad346102278f1 (diff)
downloadllvm-aec9240be2bc0bc852167b26fd2e217355ecd745.tar.gz
llvm-aec9240be2bc0bc852167b26fd2e217355ecd745.tar.bz2
llvm-aec9240be2bc0bc852167b26fd2e217355ecd745.tar.xz
Fix the SD scheduler to avoid gluing the same node twice.
DAGCombine strangeness may result in multiple loads from the same offset. They both may try to glue themselves to another load. We could insist that the redundant loads glue themselves to each other, but the beter fix is to bail out from bad gluing at the time we detect it. Fixes rdar://11314175: BuildSchedUnits assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
index 69dd813b24..8ec1ae8620 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
@@ -138,9 +138,11 @@ static void AddGlue(SDNode *N, SDValue Glue, bool AddGlue, SelectionDAG *DAG) {
// Don't add glue from a node to itself.
if (GlueDestNode == N) return;
- // Don't add glue to something which already has glue.
- if (N->getValueType(N->getNumValues() - 1) == MVT::Glue) return;
-
+ // Don't add glue to something that already has it, either as a use or value.
+ if (N->getOperand(N->getNumOperands()-1).getValueType() == MVT::Glue ||
+ N->getValueType(N->getNumValues() - 1) == MVT::Glue) {
+ return;
+ }
for (unsigned I = 0, E = N->getNumValues(); I != E; ++I)
VTs.push_back(N->getValueType(I));