[PATCH] D132570: [InstrProf][LWI] Allow entries with duplicate probe addresses

Ellis Hoag via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 09:46:04 PDT 2022


ellis created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ellis edited the summary of this revision.
ellis added reviewers: yozhu, kyulee, wenlei.
ellis published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

It turns out that storing `CounterOffsets` to prevent two data entries from pointing to the same probe is not useful. This negatively impacts memory and speed without much benefit. Also, this prevent the possibility of enabling ICF for instrumented functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132570

Files:
  llvm/include/llvm/ProfileData/InstrProfCorrelator.h
  llvm/lib/ProfileData/InstrProfCorrelator.cpp


Index: llvm/lib/ProfileData/InstrProfCorrelator.cpp
===================================================================
--- llvm/lib/ProfileData/InstrProfCorrelator.cpp
+++ llvm/lib/ProfileData/InstrProfCorrelator.cpp
@@ -150,7 +150,6 @@
         "could not find any profile metadata in debug info");
   auto Result =
       collectPGOFuncNameStrings(NamesVec, /*doCompression=*/false, Names);
-  CounterOffsets.clear();
   NamesVec.clear();
   return Result;
 }
@@ -161,9 +160,6 @@
                                                 IntPtrT CounterOffset,
                                                 IntPtrT FunctionPtr,
                                                 uint32_t NumCounters) {
-  // Check if a probe was already added for this counter offset.
-  if (!CounterOffsets.insert(CounterOffset).second)
-    return;
   Data.push_back({
       maybeSwap<uint64_t>(IndexedInstrProf::ComputeHash(FunctionName)),
       maybeSwap<uint64_t>(CFGHash),
Index: llvm/include/llvm/ProfileData/InstrProfCorrelator.h
===================================================================
--- llvm/include/llvm/ProfileData/InstrProfCorrelator.h
+++ llvm/include/llvm/ProfileData/InstrProfCorrelator.h
@@ -118,8 +118,6 @@
   InstrProfCorrelatorImpl(InstrProfCorrelatorKind Kind,
                           std::unique_ptr<InstrProfCorrelator::Context> Ctx)
       : InstrProfCorrelator(Kind, std::move(Ctx)){};
-  llvm::DenseSet<IntPtrT> CounterOffsets;
-
   // Byte-swap the value if necessary.
   template <class T> T maybeSwap(T Value) const {
     return Ctx->ShouldSwapBytes ? sys::getSwappedBytes(Value) : Value;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132570.455253.patch
Type: text/x-patch
Size: 1616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220824/75bd5b8f/attachment.bin>


More information about the llvm-commits mailing list