diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-08-02 16:51:27 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-08-02 16:51:27 +0000 |
| commit | 6d149e0215a285abef21b46e4ed0f7a1f50271ea (patch) | |
| tree | 1ba040790169788c688aa73f9e4083e2b3f2e73b /llvm/lib/VMCore/Dominators.cpp | |
| parent | 35d69af46f28bc2d9d96f22ee910430723a2e725 (diff) | |
| download | bcm5719-llvm-6d149e0215a285abef21b46e4ed0f7a1f50271ea.tar.gz bcm5719-llvm-6d149e0215a285abef21b46e4ed0f7a1f50271ea.zip | |
Fix bug: test/Regression/Other/2002-08-02-DomSetProblem.ll
llvm-svn: 3213
Diffstat (limited to 'llvm/lib/VMCore/Dominators.cpp')
| -rw-r--r-- | llvm/lib/VMCore/Dominators.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Dominators.cpp b/llvm/lib/VMCore/Dominators.cpp index eb57587387c..a3884025b35 100644 --- a/llvm/lib/VMCore/Dominators.cpp +++ b/llvm/lib/VMCore/Dominators.cpp @@ -60,7 +60,7 @@ bool DominatorSet::runOnFunction(Function &F) { // in at least once. We are guaranteed to have this because we are // traversing the graph in DFO and have handled start nodes specially. // - while (Doms[*PI].size() == 0) ++PI; + while (Doms[*PI].empty()) ++PI; WorkingSet = Doms[*PI]; for (++PI; PI != PEnd; ++PI) { // Intersect all of the predecessor sets @@ -79,6 +79,17 @@ bool DominatorSet::runOnFunction(Function &F) { WorkingSet.clear(); // Clear out the set for next iteration } } while (Changed); + + // Every basic block in the function should at least dominate themselves, and + // thus every basic block should have an entry in Doms. The one case where we + // miss this is when a basic block is unreachable. To get these we now do an + // extra pass adding self dominance info to the DomSet if the block doesn't + // already have an entry. + // + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) + if (!Doms.count(I)) + Doms[I].insert(I); + return false; } |

