Skip to content

Commit e87fc8c

Browse files
committedFeb 12, 2017
[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
1 parent a164f47 commit e87fc8c

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed
 

‎llvm/lib/Passes/PassBuilder.cpp

+6-14
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,9 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
431431
GlobalCleanupPM.addPass(SimplifyCFGPass());
432432
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(GlobalCleanupPM)));
433433

434-
// FIXME: Enable this when cross-IR-unit analysis invalidation is working.
435-
#if 0
436-
MPM.addPass(RequireAnalysisPass<GlobalsAA>());
437-
#endif
434+
// Require the GlobalsAA analysis for the module so we can query it within
435+
// the CGSCC pipeline.
436+
MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
438437

439438
// Now begin the main postorder CGSCC pipeline.
440439
// FIXME: The current CGSCC pipeline has its origins in the legacy pass
@@ -482,17 +481,14 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
482481
// FIXME: Is this really an optimization rather than a canonicalization?
483482
MPM.addPass(ReversePostOrderFunctionAttrsPass());
484483

485-
// Recompute GloblasAA here prior to function passes. This is particularly
484+
// Re-require GloblasAA here prior to function passes. This is particularly
486485
// useful as the above will have inlined, DCE'ed, and function-attr
487486
// propagated everything. We should at this point have a reasonably minimal
488487
// and richly annotated call graph. By computing aliasing and mod/ref
489488
// information for all local globals here, the late loop passes and notably
490489
// the vectorizer will be able to use them to help recognize vectorizable
491490
// memory operations.
492-
// FIXME: Enable this once analysis invalidation is fully supported.
493-
#if 0
494-
MPM.addPass(Require<GlobalsAA>());
495-
#endif
491+
MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
496492

497493
FunctionPassManager OptimizePM(DebugLogging);
498494
OptimizePM.addPass(Float2IntPass());
@@ -766,12 +762,8 @@ AAManager PassBuilder::buildDefaultAAPipeline() {
766762
// Add support for querying global aliasing information when available.
767763
// Because the `AAManager` is a function analysis and `GlobalsAA` is a module
768764
// analysis, all that the `AAManager` can do is query for any *cached*
769-
// results from `GlobalsAA` through a readonly proxy..
770-
#if 0
771-
// FIXME: Enable once the invalidation logic supports this. Currently, the
772-
// `AAManager` will hold stale references to the module analyses.
765+
// results from `GlobalsAA` through a readonly proxy.
773766
AA.registerModuleAnalysis<GlobalsAA>();
774-
#endif
775767

776768
return AA;
777769
}

‎llvm/test/Other/new-pm-defaults.ll

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
; CHECK-O-NEXT: Running pass: InstCombinePass
5858
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
5959
; CHECK-O-NEXT: Finished llvm::Function pass manager run.
60+
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
61+
; CHECK-O-NEXT: Running analysis: GlobalsAA
62+
; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
6063
; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}LazyCallGraph{{.*}}>
6164
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
6265
; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
@@ -127,7 +130,7 @@
127130
; CHECK-O-NEXT: Finished CGSCC pass manager run.
128131
; CHECK-O-NEXT: Running pass: EliminateAvailableExternallyPass
129132
; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass
130-
; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
133+
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
131134
; CHECK-O-NEXT: Running pass: ModuleToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
132135
; CHECK-O-NEXT: Starting llvm::Function pass manager run.
133136
; CHECK-O-NEXT: Running pass: Float2IntPass

0 commit comments

Comments
 (0)
Please sign in to comment.