diff options
author | Andrew Trick <atrick@apple.com> | 2011-05-06 21:52:52 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2011-05-06 21:52:52 +0000 |
commit | 9b668535a8900a0a86dfa410e2ed843db4b5555e (patch) | |
tree | b9e7e01c7136e0622047f5175965736946cc25b5 /lib/CodeGen | |
parent | 308fba5fe2714f28984d973d79f948dc24ba23b4 (diff) | |
download | llvm-9b668535a8900a0a86dfa410e2ed843db4b5555e.tar.gz llvm-9b668535a8900a0a86dfa410e2ed843db4b5555e.tar.bz2 llvm-9b668535a8900a0a86dfa410e2ed843db4b5555e.tar.xz |
Added an assertion, and updated a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131022 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/ScheduleDAGInstrs.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/CodeGen/ScheduleDAGInstrs.cpp b/lib/CodeGen/ScheduleDAGInstrs.cpp index b56f1421ba..5bafc24ded 100644 --- a/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -220,6 +220,10 @@ void ScheduleDAGInstrs::BuildSchedGraph(AliasAnalysis *AA) { // ExitSU. AddSchedBarrierDeps(); + for (int i = 0, e = TRI->getNumRegs(); i != e; ++i) { + assert(Defs[i].empty() && "Only BuildGraph should push/pop Defs"); + } + // Walk the list of instructions, from bottom moving up. for (MachineBasicBlock::iterator MII = InsertPos, MIE = Begin; MII != MIE; --MII) { @@ -264,6 +268,7 @@ void ScheduleDAGInstrs::BuildSchedGraph(AliasAnalysis *AA) { } std::vector<SUnit *> &UseList = Uses[Reg]; + // Defs are push in the order they are visited and never reordered. std::vector<SUnit *> &DefList = Defs[Reg]; // Optionally add output and anti dependencies. For anti // dependencies we use a latency of 0 because for a multi-issue @@ -283,9 +288,9 @@ void ScheduleDAGInstrs::BuildSchedGraph(AliasAnalysis *AA) { DefSU->addPred(SDep(SU, Kind, AOLatency, /*Reg=*/Reg)); } for (const unsigned *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias) { - std::vector<SUnit *> &DefList = Defs[*Alias]; - for (unsigned i = 0, e = DefList.size(); i != e; ++i) { - SUnit *DefSU = DefList[i]; + std::vector<SUnit *> &MemDefList = Defs[*Alias]; + for (unsigned i = 0, e = MemDefList.size(); i != e; ++i) { + SUnit *DefSU = MemDefList[i]; if (DefSU == &ExitSU) continue; if (DefSU != SU && @@ -399,8 +404,6 @@ void ScheduleDAGInstrs::BuildSchedGraph(AliasAnalysis *AA) { // to the DefList making dependence checking quadratic in the size of // the block. Instead, we leave only one call at the back of the // DefList. - // - // NOTE: This assumes that the DefList is ordered! if (SU->isCall) { while (!DefList.empty() && DefList.back()->isCall) DefList.pop_back(); |