[llvm] r352986 - [DA][NewPM] Handle transitive dependencies in the new-pm version of DA
Philip Pfaffe via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 3 04:25:41 PST 2019
Author: pfaffe
Date: Sun Feb 3 04:25:41 2019
New Revision: 352986
URL: http://llvm.org/viewvc/llvm-project?rev=352986&view=rev
Log:
[DA][NewPM] Handle transitive dependencies in the new-pm version of DA
Summary:
The analysis result of DA caches pointers to AA, SCEV, and LI, but it
never checks for their invalidation. Fix that.
Reviewers: chandlerc, dmgreen, bogner
Reviewed By: dmgreen
Subscribers: hiraditya, bollu, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D56381
Added:
llvm/trunk/test/Analysis/DependenceAnalysis/new-pm-invalidation.ll
Modified:
llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h
llvm/trunk/lib/Analysis/DependenceAnalysis.cpp
Modified: llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h?rev=352986&r1=352985&r2=352986&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h Sun Feb 3 04:25:41 2019
@@ -274,6 +274,10 @@ template <typename T> class ArrayRef;
LoopInfo *LI)
: AA(AA), SE(SE), LI(LI), F(F) {}
+ /// Handle transitive invalidation when the cached analysis results go away.
+ bool invalidate(Function &F, const PreservedAnalyses &PA,
+ FunctionAnalysisManager::Invalidator &Inv);
+
/// depends - Tests for a dependence between the Src and Dst instructions.
/// Returns NULL if no dependence; otherwise, returns a Dependence (or a
/// FullDependence) with as much information as can be gleaned.
Modified: llvm/trunk/lib/Analysis/DependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DependenceAnalysis.cpp?rev=352986&r1=352985&r2=352986&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/DependenceAnalysis.cpp Sun Feb 3 04:25:41 2019
@@ -3368,6 +3368,19 @@ static void dumpSmallBitVector(SmallBitV
}
#endif
+bool DependenceInfo::invalidate(Function &F, const PreservedAnalyses &PA,
+ FunctionAnalysisManager::Invalidator &Inv) {
+ // Check if the analysis itself has been invalidated.
+ auto PAC = PA.getChecker<DependenceAnalysis>();
+ if (!PAC.preserved() && !PAC.preservedSet<AllAnalysesOn<Function>>())
+ return true;
+
+ // Check transitive dependencies.
+ return Inv.invalidate<AAManager>(F, PA) ||
+ Inv.invalidate<ScalarEvolutionAnalysis>(F, PA) ||
+ Inv.invalidate<LoopAnalysis>(F, PA);
+}
+
// depends -
// Returns NULL if there is no dependence.
// Otherwise, return a Dependence with as many details as possible.
Added: llvm/trunk/test/Analysis/DependenceAnalysis/new-pm-invalidation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/DependenceAnalysis/new-pm-invalidation.ll?rev=352986&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/DependenceAnalysis/new-pm-invalidation.ll (added)
+++ llvm/trunk/test/Analysis/DependenceAnalysis/new-pm-invalidation.ll Sun Feb 3 04:25:41 2019
@@ -0,0 +1,16 @@
+; RUN: opt < %s -passes='require<da>,invalidate<scalar-evolution>,print<da>' \
+; RUN: -disable-output -debug-pass-manager 2>&1 | FileCheck %s
+
+; CHECK: Running analysis: DependenceAnalysis on test_no_noalias
+; CHECK: Running analysis: ScalarEvolutionAnalysis on test_no_noalias
+; CHECK: Invalidating analysis: ScalarEvolutionAnalysis on test_no_noalias
+; CHECK: Invalidating analysis: DependenceAnalysis on test_no_noalias
+; CHECK: Running analysis: DependenceAnalysis on test_no_noalias
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+define void @test_no_noalias(i32* %A, i32* %B) {
+ store i32 1, i32* %A
+ store i32 2, i32* %B
+ ret void
+}
More information about the llvm-commits
mailing list