mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Revert "[NPM] Do not run function simplification pipeline unnecessarily"
This reverts commit 97ab068034161fb35e5c9a7b293bf1e569cf077b. Depends on D100917, which is to be reverted.
This commit is contained in:
parent
627b91d7fb
commit
6347acc246
@ -487,18 +487,6 @@ private:
|
|||||||
std::unique_ptr<PassConceptT> Pass;
|
std::unique_ptr<PassConceptT> Pass;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A 'signaling' analysis to indicate whether a function has been changed. It
|
|
||||||
/// is meant to control the runs of the function pass(es) managed by the
|
|
||||||
/// FunctionAnalysisManagerCGSCCProxy.
|
|
||||||
class FunctionStatusAnalysis
|
|
||||||
: public AnalysisInfoMixin<FunctionStatusAnalysis> {
|
|
||||||
public:
|
|
||||||
static AnalysisKey Key;
|
|
||||||
struct Result {};
|
|
||||||
|
|
||||||
Result run(Function &F, FunctionAnalysisManager &FAM) { return Result(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A function to deduce a function pass type and wrap it in the
|
/// A function to deduce a function pass type and wrap it in the
|
||||||
/// templated adaptor.
|
/// templated adaptor.
|
||||||
template <typename FunctionPassT>
|
template <typename FunctionPassT>
|
||||||
|
@ -44,8 +44,6 @@ static cl::opt<bool> AbortOnMaxDevirtIterationsReached(
|
|||||||
cl::desc("Abort when the max iterations for devirtualization CGSCC repeat "
|
cl::desc("Abort when the max iterations for devirtualization CGSCC repeat "
|
||||||
"pass is reached"));
|
"pass is reached"));
|
||||||
|
|
||||||
AnalysisKey FunctionStatusAnalysis::Key;
|
|
||||||
|
|
||||||
// Explicit instantiations for the core proxy templates.
|
// Explicit instantiations for the core proxy templates.
|
||||||
template class AllAnalysesOn<LazyCallGraph::SCC>;
|
template class AllAnalysesOn<LazyCallGraph::SCC>;
|
||||||
template class AnalysisManager<LazyCallGraph::SCC, LazyCallGraph &>;
|
template class AnalysisManager<LazyCallGraph::SCC, LazyCallGraph &>;
|
||||||
@ -543,13 +541,6 @@ PreservedAnalyses CGSCCToFunctionPassAdaptor::run(LazyCallGraph::SCC &C,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Function &F = N->getFunction();
|
Function &F = N->getFunction();
|
||||||
// The expectation here is that FunctionStatusAnalysis was required at the
|
|
||||||
// end of the function passes pipeline managed by this adaptor. Then, if any
|
|
||||||
// CGSCC passes were re-run because CGSCCs changed (or devirtualization),
|
|
||||||
// and none changed F, then FunctionStatusAnalysis would still be cached
|
|
||||||
// here and we don't need to rerun the passes managed by this adaptor.
|
|
||||||
if (FAM.getCachedResult<FunctionStatusAnalysis>(F))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
PassInstrumentation PI = FAM.getResult<PassInstrumentationAnalysis>(F);
|
PassInstrumentation PI = FAM.getResult<PassInstrumentationAnalysis>(F);
|
||||||
if (!PI.runBeforePass<Function>(*Pass, F))
|
if (!PI.runBeforePass<Function>(*Pass, F))
|
||||||
|
@ -277,11 +277,6 @@ static cl::opt<bool> EnableO3NonTrivialUnswitching(
|
|||||||
"enable-npm-O3-nontrivial-unswitch", cl::init(true), cl::Hidden,
|
"enable-npm-O3-nontrivial-unswitch", cl::init(true), cl::Hidden,
|
||||||
cl::ZeroOrMore, cl::desc("Enable non-trivial loop unswitching for -O3"));
|
cl::ZeroOrMore, cl::desc("Enable non-trivial loop unswitching for -O3"));
|
||||||
|
|
||||||
static cl::opt<bool> DoNotRerunFunctionPasses(
|
|
||||||
"cgscc-npm-no-fp-rerun", cl::init(false),
|
|
||||||
cl::desc("Do not rerun function passes wrapped by the scc pass adapter, if "
|
|
||||||
"they were run already and the function hasn't changed."));
|
|
||||||
|
|
||||||
PipelineTuningOptions::PipelineTuningOptions() {
|
PipelineTuningOptions::PipelineTuningOptions() {
|
||||||
LoopInterleaving = true;
|
LoopInterleaving = true;
|
||||||
LoopVectorization = true;
|
LoopVectorization = true;
|
||||||
@ -1027,10 +1022,8 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
|
|||||||
|
|
||||||
// Lastly, add the core function simplification pipeline nested inside the
|
// Lastly, add the core function simplification pipeline nested inside the
|
||||||
// CGSCC walk.
|
// CGSCC walk.
|
||||||
auto FSP = buildFunctionSimplificationPipeline(Level, Phase);
|
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
|
||||||
if (DoNotRerunFunctionPasses)
|
buildFunctionSimplificationPipeline(Level, Phase)));
|
||||||
FSP.addPass(RequireAnalysisPass<FunctionStatusAnalysis, Function>());
|
|
||||||
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(std::move(FSP)));
|
|
||||||
|
|
||||||
return MIWP;
|
return MIWP;
|
||||||
}
|
}
|
||||||
@ -1189,9 +1182,6 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
|
|||||||
MPM.addPass(SyntheticCountsPropagation());
|
MPM.addPass(SyntheticCountsPropagation());
|
||||||
|
|
||||||
MPM.addPass(buildInlinerPipeline(Level, Phase));
|
MPM.addPass(buildInlinerPipeline(Level, Phase));
|
||||||
if (DoNotRerunFunctionPasses)
|
|
||||||
MPM.addPass(createModuleToFunctionPassAdaptor(
|
|
||||||
InvalidateAnalysisPass<FunctionStatusAnalysis>()));
|
|
||||||
|
|
||||||
if (EnableMemProfiler && Phase != ThinOrFullLTOPhase::ThinLTOPreLink) {
|
if (EnableMemProfiler && Phase != ThinOrFullLTOPhase::ThinLTOPreLink) {
|
||||||
MPM.addPass(createModuleToFunctionPassAdaptor(MemProfilerPass()));
|
MPM.addPass(createModuleToFunctionPassAdaptor(MemProfilerPass()));
|
||||||
|
@ -173,7 +173,6 @@ FUNCTION_ANALYSIS("targetir",
|
|||||||
FUNCTION_ANALYSIS("verify", VerifierAnalysis())
|
FUNCTION_ANALYSIS("verify", VerifierAnalysis())
|
||||||
FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
|
FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
|
||||||
FUNCTION_ANALYSIS("divergence", DivergenceAnalysis())
|
FUNCTION_ANALYSIS("divergence", DivergenceAnalysis())
|
||||||
FUNCTION_ANALYSIS("func-status", FunctionStatusAnalysis())
|
|
||||||
|
|
||||||
#ifndef FUNCTION_ALIAS_ANALYSIS
|
#ifndef FUNCTION_ALIAS_ANALYSIS
|
||||||
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
|
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
; RUN: opt %s -disable-verify -disable-output -passes='default<O2>' -debug-pass-manager=verbose -cgscc-npm-no-fp-rerun=1 \
|
|
||||||
; RUN: 2>&1 | FileCheck %s -check-prefixes=CHECK,NOREPS
|
|
||||||
; RUN: opt %s -disable-verify -disable-output -passes='default<O2>' -debug-pass-manager=verbose -cgscc-npm-no-fp-rerun=0 \
|
|
||||||
; RUN: 2>&1 | FileCheck %s -check-prefixes=CHECK,REPS
|
|
||||||
|
|
||||||
; Pre-attribute the functions to avoid the PostOrderFunctionAttrsPass cause
|
|
||||||
; changes (and keep the test simple)
|
|
||||||
attributes #0 = { nofree noreturn nosync nounwind readnone }
|
|
||||||
|
|
||||||
define void @f1(void()* %p) {
|
|
||||||
call void %p()
|
|
||||||
ret void
|
|
||||||
}
|
|
||||||
|
|
||||||
define void @f2() #0 {
|
|
||||||
call void @f1(void()* @f2)
|
|
||||||
call void @f3()
|
|
||||||
ret void
|
|
||||||
}
|
|
||||||
|
|
||||||
define void @f3() #0 {
|
|
||||||
call void @f2()
|
|
||||||
ret void
|
|
||||||
}
|
|
||||||
|
|
||||||
; CHECK: Running pass: PassManager{{.*}}CGSCC
|
|
||||||
; CHECK-NEXT: Running pass: InlinerPass on (f1)
|
|
||||||
; NOREPS: Running analysis: FunctionStatusAnalysis on f1
|
|
||||||
|
|
||||||
; CHECK: Running pass: PassManager{{.*}}CGSCC
|
|
||||||
; CHECK-NEXT: Running pass: InlinerPass on (f2, f3)
|
|
||||||
; NOREPS: Running analysis: FunctionStatusAnalysis on f2
|
|
||||||
|
|
||||||
; CHECK: Running pass: PassManager{{.*}}CGSCC
|
|
||||||
; CHECK-NEXT: Running pass: InlinerPass on (f2)
|
|
||||||
; REPS: Running pass: SROA on f2
|
|
||||||
; NOREPS-NOT: Running pass: SROA on f2
|
|
||||||
|
|
||||||
; CHECK: Running pass: PassManager{{.*}}CGSCC
|
|
||||||
; CHECK-NEXT: Running pass: InlinerPass on (f3)
|
|
||||||
; CHECK: Running pass: SROA on f3
|
|
@ -251,7 +251,6 @@ public:
|
|||||||
" call void @h1()\n"
|
" call void @h1()\n"
|
||||||
" ret void\n"
|
" ret void\n"
|
||||||
"}\n")) {
|
"}\n")) {
|
||||||
FAM.registerPass([&] { return FunctionStatusAnalysis(); });
|
|
||||||
FAM.registerPass([&] { return TargetLibraryAnalysis(); });
|
FAM.registerPass([&] { return TargetLibraryAnalysis(); });
|
||||||
MAM.registerPass([&] { return LazyCallGraphAnalysis(); });
|
MAM.registerPass([&] { return LazyCallGraphAnalysis(); });
|
||||||
MAM.registerPass([&] { return FunctionAnalysisManagerModuleProxy(FAM); });
|
MAM.registerPass([&] { return FunctionAnalysisManagerModuleProxy(FAM); });
|
||||||
|
Loading…
Reference in New Issue
Block a user