[PATCH] D134909: [PGO] Disable value profiling on Fuchsia

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 14:40:15 PDT 2022


paulkirth created this revision.
Herald added subscribers: Enna1, abrachet, wenlei, phosek, hiraditya.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fuchsia currently does not support value profiling, so disable it
similar to how ProfileCounterRelocations are enabled for it by default.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134909

Files:
  llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp


Index: llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -839,6 +839,12 @@
   }
 }
 
+static bool isValueProfilingDisabled(const Module *M) {
+  Triple TT(M->getTargetTriple());
+  // Fuchsia uses runtime counter relocation by default.
+  return TT.isOSFuchsia() || DisableValueProfiling;
+}
+
 // Visit all edge and instrument the edges not in MST, and do value profiling.
 // Critical edges will be split.
 static void instrumentOneFunc(
@@ -890,7 +896,7 @@
                                        FuncInfo.FunctionHash);
   assert(I == NumCounters);
 
-  if (DisableValueProfiling)
+  if (isValueProfilingDisabled(M))
     return;
 
   NumOfPGOICall += FuncInfo.ValueSites[IPVK_IndirectCallTarget].size();
@@ -1774,7 +1780,7 @@
 
 // Traverse all valuesites and annotate the instructions for all value kind.
 void PGOUseFunc::annotateValueSites() {
-  if (DisableValueProfiling)
+  if (isValueProfilingDisabled(M))
     return;
 
   // Create the PGOFuncName meta data.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134909.464036.patch
Type: text/x-patch
Size: 1179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220929/3881a92d/attachment.bin>


More information about the llvm-commits mailing list