[PATCH] D128859: [llvm-profgen] Do not cache the frame location stack during computing inlined context size

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 14:56:27 PDT 2022


wlei created this revision.
Herald added subscribers: hoy, wenlei.
Herald added a project: All.
wlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128859

Files:
  llvm/tools/llvm-profgen/ProfiledBinary.cpp
  llvm/tools/llvm-profgen/ProfiledBinary.h


Index: llvm/tools/llvm-profgen/ProfiledBinary.h
===================================================================
--- llvm/tools/llvm-profgen/ProfiledBinary.h
+++ llvm/tools/llvm-profgen/ProfiledBinary.h
@@ -492,13 +492,19 @@
   // Load the symbols from debug table and populate into symbol list.
   void populateSymbolListFromDWARF(ProfileSymbolList &SymbolList);
 
+  SampleContextFrameVector
+  getFrameLocationStackWithoutCaching(uint64_t Offset,
+                                      bool UseProbeDiscriminator = false) {
+    InstructionPointer IP(this, Offset);
+    return symbolize(IP, true, UseProbeDiscriminator);
+  }
+
   const SampleContextFrameVector &
   getFrameLocationStack(uint64_t Offset, bool UseProbeDiscriminator = false) {
     auto I = Offset2LocStackMap.emplace(Offset, SampleContextFrameVector());
-    if (I.second) {
-      InstructionPointer IP(this, Offset);
-      I.first->second = symbolize(IP, true, UseProbeDiscriminator);
-    }
+    if (I.second)
+      I.first->second =
+          getFrameLocationStackWithoutCaching(Offset, UseProbeDiscriminator);
     return I.first->second;
   }
 
Index: llvm/tools/llvm-profgen/ProfiledBinary.cpp
===================================================================
--- llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -817,8 +817,8 @@
 
   do {
     uint64_t Offset = virtualAddrToOffset(IP.Address);
-    const SampleContextFrameVector &SymbolizedCallStack =
-        getFrameLocationStack(Offset, UsePseudoProbes);
+    SampleContextFrameVector SymbolizedCallStack =
+        getFrameLocationStackWithoutCaching(Offset, UsePseudoProbes);
     uint64_t Size = Offset2InstSizeMap[Offset];
 
     // Record instruction size for the corresponding context


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128859.441180.patch
Type: text/x-patch
Size: 1779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220629/80fa7232/attachment.bin>


More information about the llvm-commits mailing list