mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes
Check with the analysis result by calling invalidate instead of clear on the analysis manager. Differential Revision: https://reviews.llvm.org/D98440
This commit is contained in:
parent
d97ffcdf36
commit
c85bdf8369
@ -720,7 +720,7 @@ bool FunctionAnalysisManagerCGSCCProxy::Result::invalidate(
|
||||
auto PAC = PA.getChecker<FunctionAnalysisManagerCGSCCProxy>();
|
||||
if (!PAC.preserved() && !PAC.preservedSet<AllAnalysesOn<LazyCallGraph::SCC>>()) {
|
||||
for (LazyCallGraph::Node &N : C)
|
||||
FAM->clear(N.getFunction(), N.getFunction().getName());
|
||||
FAM->invalidate(N.getFunction(), PA);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1942,5 +1942,30 @@ TEST_F(CGSCCPassManagerTest, TestInsertionOfNewNonTrivialCallEdge) {
|
||||
ASSERT_TRUE(Ran);
|
||||
}
|
||||
|
||||
TEST_F(CGSCCPassManagerTest, TestFunctionPassesAreQueriedForInvalidation) {
|
||||
std::unique_ptr<Module> M = parseIR("define void @f() { ret void }");
|
||||
CGSCCPassManager CGPM;
|
||||
bool SCCCalled = false;
|
||||
FunctionPassManager FPM;
|
||||
int ImmRuns = 0;
|
||||
FAM.registerPass([&] { return TestImmutableFunctionAnalysis(ImmRuns); });
|
||||
FPM.addPass(RequireAnalysisPass<TestImmutableFunctionAnalysis, Function>());
|
||||
CGPM.addPass(
|
||||
LambdaSCCPass([&](LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
|
||||
LazyCallGraph &CG, CGSCCUpdateResult &UR) {
|
||||
SCCCalled = true;
|
||||
return PreservedAnalyses::none();
|
||||
}));
|
||||
CGPM.addPass(createCGSCCToFunctionPassAdaptor(
|
||||
RequireAnalysisPass<TestImmutableFunctionAnalysis, Function>()));
|
||||
ModulePassManager MPM;
|
||||
|
||||
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
|
||||
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
|
||||
MPM.run(*M, MAM);
|
||||
ASSERT_EQ(ImmRuns, 1);
|
||||
ASSERT_TRUE(SCCCalled);
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user