[llvm] a79e909 - [PGOInstrumentation] Properly report module modifications

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 15:10:49 PDT 2023


Author: Arthur Eubanks
Date: 2023-04-25T15:09:30-07:00
New Revision: a79e9096ca7659dd2d3b0a297ef0be3e5725530c

URL: https://github.com/llvm/llvm-project/commit/a79e9096ca7659dd2d3b0a297ef0be3e5725530c
DIFF: https://github.com/llvm/llvm-project/commit/a79e9096ca7659dd2d3b0a297ef0be3e5725530c.diff

LOG: [PGOInstrumentation] Properly report module modifications

A global variable is added by the pass.

Detected by an upcoming change.

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index df0dd0ae1c17b..673cc0c6c36f2 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -2092,7 +2092,10 @@ PGOInstrumentationGenCreateVar::run(Module &M, ModuleAnalysisManager &AM) {
   // The variable in a comdat may be discarded by LTO. Ensure the declaration
   // will be retained.
   appendToCompilerUsed(M, createIRLevelProfileFlagVar(M, /*IsCS=*/true));
-  return PreservedAnalyses::all();
+  PreservedAnalyses PA;
+  PA.preserve<FunctionAnalysisManagerModuleProxy>();
+  PA.preserveSet<AllAnalysesOn<Function>>();
+  return PA;
 }
 
 PreservedAnalyses PGOInstrumentationGen::run(Module &M,


        


More information about the llvm-commits mailing list