[llvm] [SHT_LLVM_BB_ADDR_MAP][AsmPrinter] Implements PGOAnalysisMap emitting in AsmPrinter with tests. (PR #75202)

Rahman Lavaee via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 11:24:27 PST 2023


================
@@ -1932,8 +2000,15 @@ void AsmPrinter::emitFunctionBody() {
 
   // Emit section containing BB address offsets and their metadata, when
   // BB labels are requested for this function. Skip empty functions.
-  if (MF->hasBBLabels() && HasAnyRealCode)
+  bool HasBBLabels = MF->hasBBLabels();
+  if (HasBBLabels && HasAnyRealCode)
     emitBBAddrMapSection(*MF);
+  else if (!HasBBLabels && HasAnyRealCode &&
+           PgoAnalysisMapFeatures.getBits() != 0)
+    MF->getContext().reportWarning(
+        SMLoc(), "pgo-analysis-map is enabled but the following machine "
+                 "function was does not have labels: " +
----------------
rlavaee wrote:

typo. (was done).

Also, when saying "machine function" users probably expect MIR to follow. So Maybe change to:
"pgo-analysis map is enabled the function " << MF->getName() << " does not have basic block labels".

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


More information about the llvm-commits mailing list