From d953d0173776e7f7109b35ac2e74259dd126ab74 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 19 Sep 2022 11:59:35 +0100 Subject: [PATCH] Introduce -enable-global-analyses to allow users to disable inter-procedural analyses Alive2 doesn't support verification of optimizations that use inter-procedural analyses. Right now, clang uses GlobalsAA by default and there's no way to disable it. This leads to Alive2 producing false positives. The added flag allows us to skip global analyses altogether. Differential Revision: https://reviews.llvm.org/D134139 --- llvm/lib/Passes/PassBuilderPipelines.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 9255c01..6d6b074 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -186,6 +186,10 @@ static cl::opt EnablePostPGOLoopRotation( "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 @@ AAManager PassBuilder::buildDefaultAAPipeline() { // 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) -- 2.7.4