[llvm] [StaticDataLayout][MemProf] Record whether the IR is compiled with data access profiles by module flag. (PR #162333)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 13:07:38 PDT 2025


================
@@ -798,13 +798,15 @@ bool MemProfUsePass::annotateGlobalVariables(
     return false;
 
   if (!DataAccessProf) {
+    M.addModuleFlag(Module::Warning, "EnableDataAccessProf", 0U);
----------------
teresajohnson wrote:

Thanks for the explanation, this makes sense.

> I wonder if it's clearer to combine 1) and 2) so the module flag is always present as long as this pass runs.

I don't think you want to do that, because a module without any globals would get a flag value of 0, and per Module::Warning semantics, if it is combined with another module via an LTO link the first value would win. I think you want this to emit the same value, or none, for all modules using the same profile.

https://github.com/llvm/llvm-project/pull/162333


More information about the llvm-commits mailing list