[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

Devang Patel dpatel at apple.com
Thu Dec 7 14:34:36 PST 2006



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.53 -> 1.54
---
Log message:

When new pass manager is created, initialize available analysis info
of existing manager at the same level. Otherwise, such info may be 
considered as available, which not true.


---
Diffs of the changes:  (+26 -9)

 PassManager.cpp |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.53 llvm/lib/VMCore/PassManager.cpp:1.54
--- llvm/lib/VMCore/PassManager.cpp:1.53	Thu Dec  7 16:17:09 2006
+++ llvm/lib/VMCore/PassManager.cpp	Thu Dec  7 16:34:21 2006
@@ -652,13 +652,17 @@
   // If P is a BasicBlockPass then use BasicBlockPassManager_New.
   if (BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P)) {
 
-    if (!activeBBPassManager
-        || !activeBBPassManager->addPass(BP)) {
+    if (!activeBBPassManager || !activeBBPassManager->addPass(BP)) {
 
-      // TODO : intialize AvailableAnalysis info
+      // If active manager exists then clear its analysis info.
+      if (activeBBPassManager)
+        activeBBPassManager->initializeAnalysisInfo();
 
+      // Create and add new manager
       activeBBPassManager = new BasicBlockPassManager_New();
       addPassToManager(activeBBPassManager, false);
+
+      // Add pass into new manager. This time it must succeed.
       if (!activeBBPassManager->addPass(BP))
         assert(0 && "Unable to add Pass");
     }
@@ -675,8 +679,13 @@
     return false;
 
   addPassToManager (FP);
-  // TODO : intialize AvailableAnalysis info
-  activeBBPassManager = NULL;
+
+  // If active manager exists then clear its analysis info.
+  if (activeBBPassManager) {
+    activeBBPassManager->initializeAnalysisInfo();
+    activeBBPassManager = NULL;
+  }
+
   return true;
 }
 
@@ -784,11 +793,15 @@
     if (!activeFunctionPassManager
         || !activeFunctionPassManager->addPass(P)) {
 
-      // TODO : intialize AvailableAnalysis info
-      activeFunctionPassManager = NULL;
+      // If active manager exists then clear its analysis info.
+      if (activeFunctionPassManager) 
+        activeFunctionPassManager->initializeAnalysisInfo();
 
+      // Create and add new manager
       activeFunctionPassManager = new FunctionPassManagerImpl_New();
       addPassToManager(activeFunctionPassManager, false);
+
+      // Add pass into new manager. This time it must succeed.
       if (!activeFunctionPassManager->addPass(FP))
         assert(0 && "Unable to add pass");
     }
@@ -805,8 +818,12 @@
     return false;
 
   addPassToManager(MP);
-  // TODO : intialize AvailableAnalysis info
-  activeFunctionPassManager = NULL;
+  // If active manager exists then clear its analysis info.
+  if (activeFunctionPassManager) {
+    activeFunctionPassManager->initializeAnalysisInfo();
+    activeFunctionPassManager = NULL;
+  }
+
   return true;
 }
 






More information about the llvm-commits mailing list