[polly] r309811 - [PM] Fix proxy invalidation

Philip Pfaffe via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 06:18:49 PDT 2017


Author: pfaffe
Date: Wed Aug  2 06:18:49 2017
New Revision: 309811

URL: http://llvm.org/viewvc/llvm-project?rev=309811&view=rev
Log:
[PM] Fix proxy invalidation

Summary: I made a mistake in handling transitive invalidation of analysis results. I've updated the list of preserved analyses as well as the correct result dependences.

The Invalidator passed through the invalidate() path can be used to
transitively invalidate analyses. It frequently happens that analysis
results depend on other analyses, and thus store references to their
results. When the dependee now gets invalidated, the depender needs to
be invalidated as well. This is the purpose of the Invalidator object,
which can be used to check whether some dependee analysis is in the
process of being invalidated. I originally was checking the wrong
dependee analyses, which is an actual error, you can only check analysis
results that are in the cache (which they are if you've captured their
reference). The invalidation I'm handling inside the proxy deals with
the standard analyses the proxy passes into the Scop pipeline, since I'm
capturing their reference.

This checking allows us to actually preserve a couple of results outside
of the proxy, since the Scop pipeline shouldn't break those, or
otherwise should update them accordingly.

Reviewers: grosser, Meinersbur, bollu

Reviewed By: grosser

Subscribers: pollydev, llvm-commits

Differential Revision: https://reviews.llvm.org/D36216

Modified:
    polly/trunk/include/polly/ScopPass.h
    polly/trunk/lib/Analysis/ScopPass.cpp

Modified: polly/trunk/include/polly/ScopPass.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopPass.h?rev=309811&r1=309810&r2=309811&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopPass.h (original)
+++ polly/trunk/include/polly/ScopPass.h Wed Aug  2 06:18:49 2017
@@ -128,6 +128,7 @@ private:
 
 struct ScopStandardAnalysisResults {
   DominatorTree &DT;
+  ScopInfo &SI;
   ScalarEvolution &SE;
   LoopInfo &LI;
   RegionInfo &RI;
@@ -161,14 +162,15 @@ public:
     if (Scops.empty())
       return PA;
 
-    ScopAnalysisManager &SAM =
-        AM.getResult<ScopAnalysisManagerFunctionProxy>(F).getManager();
-
     ScopStandardAnalysisResults AR = {AM.getResult<DominatorTreeAnalysis>(F),
+                                      AM.getResult<ScopInfoAnalysis>(F),
                                       AM.getResult<ScalarEvolutionAnalysis>(F),
                                       AM.getResult<LoopAnalysis>(F),
                                       AM.getResult<RegionInfoAnalysis>(F)};
 
+    ScopAnalysisManager &SAM =
+        AM.getResult<ScopAnalysisManagerFunctionProxy>(F).getManager();
+
     SmallPriorityWorklist<Scop *, 4> Worklist;
     SPMUpdater Updater{Worklist, SAM};
 
@@ -186,6 +188,12 @@ public:
 
     PA.preserveSet<AllAnalysesOn<Scop>>();
     PA.preserve<ScopAnalysisManagerFunctionProxy>();
+    PA.preserve<DominatorTreeAnalysis>();
+    PA.preserve<ScopAnalysis>();
+    PA.preserve<ScopInfoAnalysis>();
+    PA.preserve<ScalarEvolutionAnalysis>();
+    PA.preserve<LoopAnalysis>();
+    PA.preserve<RegionInfoAnalysis>();
     return PA;
   }
 

Modified: polly/trunk/lib/Analysis/ScopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopPass.cpp?rev=309811&r1=309810&r2=309811&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopPass.cpp (original)
+++ polly/trunk/lib/Analysis/ScopPass.cpp Wed Aug  2 06:18:49 2017
@@ -76,12 +76,10 @@ bool ScopAnalysisManagerFunctionProxy::R
   // First, check whether our ScopInfo is about to be invalidated
   auto PAC = PA.getChecker<ScopAnalysisManagerFunctionProxy>();
   if (!(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>() ||
-        Inv.invalidate<ScopAnalysis>(F, PA) ||
+        Inv.invalidate<ScopInfoAnalysis>(F, PA) ||
         Inv.invalidate<ScalarEvolutionAnalysis>(F, PA) ||
         Inv.invalidate<LoopAnalysis>(F, PA) ||
-        Inv.invalidate<AAManager>(F, PA) ||
-        Inv.invalidate<DominatorTreeAnalysis>(F, PA) ||
-        Inv.invalidate<AssumptionAnalysis>(F, PA))) {
+        Inv.invalidate<DominatorTreeAnalysis>(F, PA))) {
 
     // As everything depends on ScopInfo, we must drop all existing results
     for (auto &S : *SI)




More information about the llvm-commits mailing list