[PM] Enable GlobalsAA in the new PM's pipeline by default.

All the invalidation issues and bugs in this seem to be fixed, it has
survived a full build of the test suite plus SPEC with asserts and ASan
enabled on the Clang binary used.

Differential Revision: https://reviews.llvm.org/D29815

llvm-svn: 294887
This commit is contained in:
Chandler Carruth 2017-02-12 05:34:04 +00:00
parent a164f470e6
commit e87fc8cb71
2 changed files with 10 additions and 15 deletions

View File

@ -431,10 +431,9 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
GlobalCleanupPM.addPass(SimplifyCFGPass()); GlobalCleanupPM.addPass(SimplifyCFGPass());
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(GlobalCleanupPM))); MPM.addPass(createModuleToFunctionPassAdaptor(std::move(GlobalCleanupPM)));
// FIXME: Enable this when cross-IR-unit analysis invalidation is working. // Require the GlobalsAA analysis for the module so we can query it within
#if 0 // the CGSCC pipeline.
MPM.addPass(RequireAnalysisPass<GlobalsAA>()); MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
#endif
// Now begin the main postorder CGSCC pipeline. // Now begin the main postorder CGSCC pipeline.
// FIXME: The current CGSCC pipeline has its origins in the legacy pass // FIXME: The current CGSCC pipeline has its origins in the legacy pass
@ -482,17 +481,14 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
// FIXME: Is this really an optimization rather than a canonicalization? // FIXME: Is this really an optimization rather than a canonicalization?
MPM.addPass(ReversePostOrderFunctionAttrsPass()); MPM.addPass(ReversePostOrderFunctionAttrsPass());
// Recompute GloblasAA here prior to function passes. This is particularly // Re-require GloblasAA here prior to function passes. This is particularly
// useful as the above will have inlined, DCE'ed, and function-attr // useful as the above will have inlined, DCE'ed, and function-attr
// propagated everything. We should at this point have a reasonably minimal // propagated everything. We should at this point have a reasonably minimal
// and richly annotated call graph. By computing aliasing and mod/ref // and richly annotated call graph. By computing aliasing and mod/ref
// information for all local globals here, the late loop passes and notably // information for all local globals here, the late loop passes and notably
// the vectorizer will be able to use them to help recognize vectorizable // the vectorizer will be able to use them to help recognize vectorizable
// memory operations. // memory operations.
// FIXME: Enable this once analysis invalidation is fully supported. MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
#if 0
MPM.addPass(Require<GlobalsAA>());
#endif
FunctionPassManager OptimizePM(DebugLogging); FunctionPassManager OptimizePM(DebugLogging);
OptimizePM.addPass(Float2IntPass()); OptimizePM.addPass(Float2IntPass());
@ -766,12 +762,8 @@ AAManager PassBuilder::buildDefaultAAPipeline() {
// Add support for querying global aliasing information when available. // Add support for querying global aliasing information when available.
// Because the `AAManager` is a function analysis and `GlobalsAA` is a module // Because the `AAManager` is a function analysis and `GlobalsAA` is a module
// analysis, all that the `AAManager` can do is query for any *cached* // analysis, all that the `AAManager` can do is query for any *cached*
// results from `GlobalsAA` through a readonly proxy.. // results from `GlobalsAA` through a readonly proxy.
#if 0
// FIXME: Enable once the invalidation logic supports this. Currently, the
// `AAManager` will hold stale references to the module analyses.
AA.registerModuleAnalysis<GlobalsAA>(); AA.registerModuleAnalysis<GlobalsAA>();
#endif
return AA; return AA;
} }

View File

@ -57,6 +57,9 @@
; CHECK-O-NEXT: Running pass: InstCombinePass ; CHECK-O-NEXT: Running pass: InstCombinePass
; CHECK-O-NEXT: Running pass: SimplifyCFGPass ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
; CHECK-O-NEXT: Finished llvm::Function pass manager run. ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
; CHECK-O-NEXT: Running analysis: GlobalsAA
; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}LazyCallGraph{{.*}}> ; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}LazyCallGraph{{.*}}>
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
@ -127,7 +130,7 @@
; CHECK-O-NEXT: Finished CGSCC pass manager run. ; CHECK-O-NEXT: Finished CGSCC pass manager run.
; CHECK-O-NEXT: Running pass: EliminateAvailableExternallyPass ; CHECK-O-NEXT: Running pass: EliminateAvailableExternallyPass
; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass ; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass
; CHECK-O-NEXT: Running analysis: CallGraphAnalysis ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}> ; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
; CHECK-O-NEXT: Starting llvm::Function pass manager run. ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
; CHECK-O-NEXT: Running pass: Float2IntPass ; CHECK-O-NEXT: Running pass: Float2IntPass