RequiredAnalysis support is buggy and not used at the moment so remove
authorDevang Patel <dpatel@apple.com>
Thu, 7 Dec 2006 18:47:25 +0000 (18:47 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 7 Dec 2006 18:47:25 +0000 (18:47 +0000)
the code. Add TODO note.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32313 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/PassManager.cpp

index 001ed7068f325cca53a5575f52fc1d941821582b..f46f4456b214123602147ebca8f94d1543f11101 100644 (file)
@@ -107,9 +107,6 @@ public:
       return I->second;
   }
 
-  /// Augment RequiredAnalysis by adding analysis required by pass P.
-  void noteDownRequiredAnalysis(Pass *P);
-
   /// Augment AvailableAnalysis by adding analysis made available by pass P.
   void noteDownAvailableAnalysis(Pass *P);
 
@@ -119,13 +116,12 @@ public:
   /// Remove dead passes
   void removeDeadPasses(Pass *P);
 
-  /// Add pass P into the PassVector. Update RequiredAnalysis and
+  /// Add pass P into the PassVector. Update 
   /// AvailableAnalysis appropriately if ProcessAnalysis is true.
   void addPassToManager (Pass *P, bool ProcessAnalysis = true);
 
   // Initialize available analysis information.
   void initializeAnalysisInfo() { 
-    RequiredAnalysis.clear();
     AvailableAnalysis.clear();
     LastUser.clear();
   }
@@ -151,12 +147,6 @@ public:
   }
 
 private:
-  // Analysis required by the passes managed by this manager. This information
-  // used while selecting pass manager during addPass. If a pass does not
-  // preserve any analysis required by other passes managed by current
-  // pass manager then new pass manager is used.
-  std::vector<AnalysisID> RequiredAnalysis;
-
   // Set of available Analysis. This information is used while scheduling 
   // pass. If a pass requires an analysis which is not not available then 
   // equired analysis pass is scheduled to run before the pass itself is 
@@ -307,37 +297,16 @@ private:
 /// manager.
 bool PMDataManager::manageablePass(Pass *P) {
 
-  AnalysisUsage AnUsage;
-  P->getAnalysisUsage(AnUsage);
-
-  // If this pass is not preserving information that is required by the other
-  // passes managed by this manager then use new manager
-  if (!AnUsage.getPreservesAll()) {
-    const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
-    for (std::vector<AnalysisID>::iterator I = RequiredAnalysis.begin(),
-           E = RequiredAnalysis.end(); I != E; ++I) {
-      if (std::find(PreservedSet.begin(), PreservedSet.end(), *I) == 
-          PreservedSet.end())
-        // This analysis is not preserved. Need new manager.
-        return false;
-    }
-  }
+  // TODO 
+  // If this pass is not preserving information that is required by a
+  // pass maintained by higher level pass manager then do not insert
+  // this pass into current manager. Use new manager. For example,
+  // For example, If FunctionPass F is not preserving ModulePass Info M1
+  // that is used by another ModulePass M2 then do not insert F in
+  // current function pass manager.
   return true;
 }
 
-/// Augment RequiredAnalysis by adding analysis required by pass P.
-void PMDataManager::noteDownRequiredAnalysis(Pass *P) {
-  AnalysisUsage AnUsage;
-  P->getAnalysisUsage(AnUsage);
-  const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();
-
-  // FIXME: What about duplicates ?
-  RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), 
-                          RequiredSet.end());
-
-  initializeAnalysisImpl(P);
-}
-
 /// Augement AvailableAnalysis by adding analysis made available by pass P.
 void PMDataManager::noteDownAvailableAnalysis(Pass *P) {
                                                 
@@ -389,14 +358,14 @@ void PMDataManager::removeDeadPasses(Pass *P) {
   }
 }
 
-/// Add pass P into the PassVector. Update RequiredAnalysis and
+/// Add pass P into the PassVector. Update 
 /// AvailableAnalysis appropriately if ProcessAnalysis is true.
 void PMDataManager::addPassToManager (Pass *P, 
                                               bool ProcessAnalysis) {
 
   if (ProcessAnalysis) {
     // Take a note of analysis required and made available by this pass
-    noteDownRequiredAnalysis(P);
+    initializeAnalysisImpl(P);
     noteDownAvailableAnalysis(P);
 
     // Remove the analysis not preserved by this pass