[compiler-rt] [llvm] [AIX] PGO codegen changes for function-sections. (PR #139761)

Wael Yehia via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 16:17:23 PDT 2025


================
@@ -2458,6 +2458,25 @@ MCSection *TargetLoweringObjectFileXCOFF::getExplicitSectionGlobal(
   else
     report_fatal_error("XCOFF other section types not yet implemented.");
 
+  // The profiling instrumentation symbols are special in that we want to
+  // emit a unique CSECT for each when function sections are enabeld, which
+  // are then renamed back to the CSECT name specified by the explicit section.
+  // This is to work around the limitation of not having section groups or a
+  // similar feature in XCOFF.
+  if (TM.getFunctionSections()) {
+    std::string ProfilingDataSectionName =
+        getInstrProfSectionName(IPSK_data, Triple::XCOFF, false);
+    std::string ProfilingCounterSectionName =
+        getInstrProfSectionName(IPSK_cnts, Triple::XCOFF, false);
+    if ((SectionName == ProfilingDataSectionName &&
+         GO->getName().starts_with("__profd_")) ||
----------------
w2yehia wrote:

llvm::getInstrProfDataVarPrefix() can be used in place of `"__profd_"`

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


More information about the llvm-commits mailing list