[clang] [compiler-rt] [llvm] [PGO] Initialize GCOV Writeout and Reset Functions in the Runtime on AIX (PR #108570)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 21:57:24 PDT 2024


================
@@ -914,6 +918,9 @@ bool GCOVProfiler::emitProfileNotes(
         GlobalVariable *Counters = new GlobalVariable(
             *M, CounterTy, false, GlobalValue::InternalLinkage,
             Constant::getNullValue(CounterTy), "__llvm_gcov_ctr");
+        const llvm::Triple &Triple = llvm::Triple(M->getTargetTriple());
+        if (Triple.getObjectFormat() == llvm::Triple::XCOFF)
+          Counters->setSection("__llvm_gcov_ctr_section");
----------------
hubert-reinterpretcast wrote:

I suggest moving the `.ref` generation to be from each GCOV-profiled function in the module instead of making this change. This change modifies the counters from being BSS in XCOFF to non-BSS (therefore increasing program load costs).

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


More information about the cfe-commits mailing list