[llvm-branch-commits] [llvm] [StaticDataLayout] Factor out a helper function for section prefix eligibility and use it in both optimizer and codegen (PR #162348)

Mingming Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 10 16:08:48 PDT 2025


================
@@ -817,13 +825,12 @@ bool MemProfUsePass::annotateGlobalVariables(
   for (GlobalVariable &GVar : M.globals()) {
     assert(!GVar.getSectionPrefix().has_value() &&
            "GVar shouldn't have section prefix yet");
-    if (GVar.isDeclarationForLinker())
-      continue;
-
-    if (hasExplicitSectionName(GVar)) {
-      ++NumOfMemProfExplicitSectionGlobalVars;
-      LLVM_DEBUG(dbgs() << "Global variable " << GVar.getName()
-                        << " has explicit section name. Skip annotating.\n");
+    auto Kind = llvm::memprof::getAnnotationKind(GVar);
+    switch (Kind) {
----------------
mingmingl-llvm wrote:

done in https://github.com/llvm/llvm-project/pull/162348/commits/34b47c9852b8f8beef075e3b8dacdbb2110c9d1f

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


More information about the llvm-branch-commits mailing list