mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
Reapply "[NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes"
This reverts commit 11b70b9e3a7458b5b78c30020b56e8ca563a4801. The bot failure was due to ArgumentPromotion deleting functions without deleting their analyses. This was separately fixed in 4b1c807.
This commit is contained in:
parent
a12191737e
commit
2ca653b1d6
@ -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