diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.h b/llvm/tools/llvm-profgen/ProfiledBinary.h --- a/llvm/tools/llvm-profgen/ProfiledBinary.h +++ b/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; } diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/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