[PATCH] D103717: [InstrProfiling][ELF] Make __profd_ private if the function does not use value profiling

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 14:24:40 PDT 2021


davidxl added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:891
+  uint64_t NS = 0;
+  for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)
+    NS += PD.NumValueSites[Kind];
----------------
should this code by guarded by whether value profile is enabled?


================
Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:930
   };
-  // If code never references data variables (the symbol is unneeded), and
-  // linker GC cannot discard data variables while the text section is retained,
-  // data variables can be private. This optimization applies on COFF and ELF.
-  if (!DataReferencedByCode && !TT.isOSBinFormatMachO()) {
+  // If the data variable is not referenced by code (when NS==0, i.e. no value
+  // profiling), and the counter keeps the data variable live under linker GC,
----------------
What is the root cause of the failure when NS == 0 condition is not used?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103717/new/

https://reviews.llvm.org/D103717



More information about the llvm-commits mailing list