[llvm-commits] [llvm] r54805 - in /llvm/trunk: lib/VMCore/PassManager.cpp test/Other/2008-08-14-PassManager.ll

Devang Patel dpatel at apple.com
Thu Aug 14 16:07:48 PDT 2008


Author: dpatel
Date: Thu Aug 14 18:07:48 2008
New Revision: 54805

URL: http://llvm.org/viewvc/llvm-project?rev=54805&view=rev
Log:
The pass manager is not able to schedule -loop-deletion -loop-index-split.

The loop-deletion pass does not preserve dom frontier, which is required by
loop-index-split. When the PM checks dom frontier for loop-index-split, it has
already verified that lcssa is availalble. However, new dom frontier forces new
loop pass manager, which does not  have lcssa yet.

The PM should recheck availability of required analysis passes in such cases.

Added:
    llvm/trunk/test/Other/2008-08-14-PassManager.ll
Modified:
    llvm/trunk/lib/VMCore/PassManager.cpp

Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=54805&r1=54804&r2=54805&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Thu Aug 14 18:07:48 2008
@@ -463,20 +463,34 @@
 
   AnalysisUsage *AnUsage = findAnalysisUsage(P);
 
-  const AnalysisUsage::VectorType &RequiredSet = AnUsage->getRequiredSet();
-  for (AnalysisUsage::VectorType::const_iterator I = RequiredSet.begin(),
-         E = RequiredSet.end(); I != E; ++I) {
-
-    Pass *AnalysisPass = findAnalysisPass(*I);
-    if (!AnalysisPass) {
-      AnalysisPass = (*I)->createPass();
-      // Schedule this analysis run first only if it is not a lower level
-      // analysis pass. Lower level analsyis passes are run on the fly.
-      if (P->getPotentialPassManagerType () >=
-          AnalysisPass->getPotentialPassManagerType())
-        schedulePass(AnalysisPass);
-      else
-        delete AnalysisPass;
+  bool checkAnalysis = true;
+  while (checkAnalysis) {
+    checkAnalysis = false;
+  
+    const AnalysisUsage::VectorType &RequiredSet = AnUsage->getRequiredSet();
+    for (AnalysisUsage::VectorType::const_iterator I = RequiredSet.begin(),
+           E = RequiredSet.end(); I != E; ++I) {
+      
+      Pass *AnalysisPass = findAnalysisPass(*I);
+      if (!AnalysisPass) {
+        AnalysisPass = (*I)->createPass();
+        if (P->getPotentialPassManagerType () ==
+            AnalysisPass->getPotentialPassManagerType())
+          // Schedule analysis pass that is managed by the same pass manager.
+          schedulePass(AnalysisPass);
+        else if (P->getPotentialPassManagerType () >
+                 AnalysisPass->getPotentialPassManagerType()) {
+          // Schedule analysis pass that is managed by a new manager.
+          schedulePass(AnalysisPass);
+          // Recheck analysis passes to ensure that required analysises that
+          // are already checked are still available.
+          checkAnalysis = true;
+        }
+        else
+          // Do not schedule this analysis. Lower level analsyis 
+          // passes are run on the fly.
+          delete AnalysisPass;
+      }
     }
   }
 

Added: llvm/trunk/test/Other/2008-08-14-PassManager.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2008-08-14-PassManager.ll?rev=54805&view=auto

==============================================================================
--- llvm/trunk/test/Other/2008-08-14-PassManager.ll (added)
+++ llvm/trunk/test/Other/2008-08-14-PassManager.ll Thu Aug 14 18:07:48 2008
@@ -0,0 +1,5 @@
+; RUN:  llvm-as < %s |  opt -loop-deletion -loop-index-split -disable-output
+; PR 2640
+define i32 @test1() {
+       ret i32 0;
+}





More information about the llvm-commits mailing list