Change these schedulers to not emit no-ops. It turns out that
[oota-llvm.git] / lib / VMCore / PassManager.cpp
index e3d1c5364e95f5e8869e952a845a7c7528a8e7f0..690c485fe20d65aa54d4b3fb82510afc4234bbfb 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/Analysis/Dominators.h"
 #include "llvm-c/Core.h"
 #include <algorithm>
+#include <cstdio>
 #include <vector>
 #include <map>
 using namespace llvm;
@@ -457,8 +458,10 @@ void PMTopLevelManager::schedulePass(Pass *P) {
   // generate the analysis again. Stale analysis info should not be
   // available at this point.
   if (P->getPassInfo() &&
-      P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo()))
+      P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo())) {
+    delete P;
     return;
+  }
 
   AnalysisUsage *AnUsage = findAnalysisUsage(P);
 
@@ -724,12 +727,12 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
         && std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) == 
         PreservedSet.end()) {
       // Remove this analysis
-      AvailableAnalysis.erase(Info);
       if (PassDebugging >= Details) {
         Pass *S = Info->second;
         cerr << " -- '" <<  P->getPassName() << "' is not preserving '";
         cerr << S->getPassName() << "'\n";
       }
+      AvailableAnalysis.erase(Info);
     }
   }