Verify loop info.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40062 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2007-07-19 18:02:32 +00:00
parent 6b8337392c
commit 58e0ef1e90
9 changed files with 51 additions and 28 deletions

View File

@@ -117,7 +117,8 @@ bool CGPassManager::runOnModule(Module &M) {
if (Changed)
dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, "");
dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet());
verifyPreservedAnalysis(P);
removeNotPreservedAnalysis(P);
recordAvailableAnalysis(P);
removeDeadPasses(P, "", ON_CG_MSG);

View File

@@ -81,6 +81,18 @@ void Loop::print(std::ostream &OS, unsigned Depth) const {
(*I)->print(OS, Depth+2);
}
/// verifyLoop - Verify loop structure
void Loop::verifyLoop() const {
#ifndef NDEBUG
assert (getHeader() && "Loop header is missing");
assert (getLoopPreheader() && "Loop preheader is missing");
assert (getLoopLatch() && "Loop latch is missing");
for (std::vector<Loop*>::const_iterator I = SubLoops.begin(), E = SubLoops.end();
I != E; ++I)
(*I)->verifyLoop();
#endif
}
void Loop::dump() const {
print(cerr);
}
@@ -104,7 +116,6 @@ void LoopInfo::releaseMemory() {
TopLevelLoops.clear();
}
void LoopInfo::Calculate(DominatorTree &DT) {
BasicBlock *RootNode = DT.getRootNode()->getBlock();

View File

@@ -157,18 +157,6 @@ void LPPassManager::getAnalysisUsage(AnalysisUsage &Info) const {
Info.setPreservesAll();
}
/// verifyLoopInfo - Verify loop nest.
void LPPassManager::verifyLoopInfo() {
assert (LI && "Loop Info is missing");
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) {
Loop *L = *I;
assert (L->getHeader() && "Loop header is missing");
assert (L->getLoopPreheader() && "Loop preheader is missing");
assert (L->getLoopLatch() && "Loop latch is missing");
}
}
/// run - Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the function, and if so, return true.
bool LPPassManager::runOnFunction(Function &F) {
@@ -214,13 +202,13 @@ bool LPPassManager::runOnFunction(Function &F) {
LoopPass *LP = dynamic_cast<LoopPass *>(P);
assert (LP && "Invalid LPPassManager member");
LP->runOnLoop(CurrentLoop, *this);
verifyLoopInfo();
StopPassTimer(P);
if (Changed)
dumpPassInfo(P, MODIFICATION_MSG, ON_LOOP_MSG, "");
dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet());
verifyPreservedAnalysis(LP);
removeNotPreservedAnalysis(P);
recordAvailableAnalysis(P);
removeDeadPasses(P, "", ON_LOOP_MSG);