From f081ec7609debfeaeb0220ca49c82f03c544186d Mon Sep 17 00:00:00 2001 From: Philip Pfaffe Date: Wed, 2 Aug 2017 13:18:49 +0000 Subject: [PATCH] [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 llvm-svn: 309811 --- polly/include/polly/ScopPass.h | 14 +++++++++++--- polly/lib/Analysis/ScopPass.cpp | 6 ++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/polly/include/polly/ScopPass.h b/polly/include/polly/ScopPass.h index 504daea..ca89989 100644 --- a/polly/include/polly/ScopPass.h +++ b/polly/include/polly/ScopPass.h @@ -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(F).getManager(); - ScopStandardAnalysisResults AR = {AM.getResult(F), + AM.getResult(F), AM.getResult(F), AM.getResult(F), AM.getResult(F)}; + ScopAnalysisManager &SAM = + AM.getResult(F).getManager(); + SmallPriorityWorklist Worklist; SPMUpdater Updater{Worklist, SAM}; @@ -186,6 +188,12 @@ public: PA.preserveSet>(); PA.preserve(); + PA.preserve(); + PA.preserve(); + PA.preserve(); + PA.preserve(); + PA.preserve(); + PA.preserve(); return PA; } diff --git a/polly/lib/Analysis/ScopPass.cpp b/polly/lib/Analysis/ScopPass.cpp index dfdf313..c845bf2 100644 --- a/polly/lib/Analysis/ScopPass.cpp +++ b/polly/lib/Analysis/ScopPass.cpp @@ -76,12 +76,10 @@ bool ScopAnalysisManagerFunctionProxy::Result::invalidate( // First, check whether our ScopInfo is about to be invalidated auto PAC = PA.getChecker(); if (!(PAC.preserved() || PAC.preservedSet>() || - Inv.invalidate(F, PA) || + Inv.invalidate(F, PA) || Inv.invalidate(F, PA) || Inv.invalidate(F, PA) || - Inv.invalidate(F, PA) || - Inv.invalidate(F, PA) || - Inv.invalidate(F, PA))) { + Inv.invalidate(F, PA))) { // As everything depends on ScopInfo, we must drop all existing results for (auto &S : *SI) -- 2.7.4