aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/MemProfUse.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemProfUse.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp b/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
index 5cde52637248..1a55021c5d3f 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
@@ -702,8 +702,14 @@ readMemprof(Module &M, Function &F, IndexedInstrProfReader *MemProfReader,
for (auto &StackFrame : CS.Frames) {
uint64_t StackId = computeStackId(StackFrame);
ArrayRef<Frame> FrameSlice = ArrayRef<Frame>(CS.Frames).drop_front(Idx++);
- ArrayRef<GlobalValue::GUID> CalleeGuids(CS.CalleeGuids);
- LocHashToCallSites[StackId].push_back({FrameSlice, CalleeGuids});
+ // The callee guids for the slice containing all frames (due to the
+ // increment above Idx is now 1) comes from the CalleeGuids recorded in
+ // the CallSite. For the slices not containing the leaf-most frame, the
+ // callee guid is simply the function GUID of the prior frame.
+ LocHashToCallSites[StackId].push_back(
+ {FrameSlice, (Idx == 1 ? CS.CalleeGuids
+ : ArrayRef<GlobalValue::GUID>(
+ CS.Frames[Idx - 2].Function))});
ProfileHasColumns |= StackFrame.Column;
// Once we find this function, we can stop recording.