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.
}
#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.
--- /dev/null
+; 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
+}