diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -186,6 +186,10 @@ "enable-post-pgo-loop-rotation", cl::init(true), cl::Hidden, cl::desc("Run the loop rotation transformation after PGO instrumentation")); +static cl::opt EnableGlobalAnalyses( + "enable-global-analyses", cl::init(true), cl::Hidden, + cl::desc("Enable inter-procedural analyses")); + PipelineTuningOptions::PipelineTuningOptions() { LoopInterleaving = true; LoopVectorization = true; @@ -1898,7 +1902,8 @@ // Because the `AAManager` is a function analysis and `GlobalsAA` is a module // analysis, all that the `AAManager` can do is query for any *cached* // results from `GlobalsAA` through a readonly proxy. - AA.registerModuleAnalysis(); + if (EnableGlobalAnalyses) + AA.registerModuleAnalysis(); // Add target-specific alias analyses. if (TM)