File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
llvm/lib/Transforms/Instrumentation Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -771,23 +771,15 @@ static AllocationType addCallStack(CallStackTrie &AllocTrie,
771
771
772
772
// Helper to compare the InlinedCallStack computed from an instruction's debug
773
773
// info to a list of Frames from profile data (either the allocation data or a
774
- // callsite). For callsites, the StartIndex to use in the Frame array may be
775
- // non-zero.
774
+ // callsite).
776
775
static bool
777
776
stackFrameIncludesInlinedCallStack (ArrayRef<Frame> ProfileCallStack,
778
777
ArrayRef<uint64_t > InlinedCallStack) {
779
- auto StackFrame = ProfileCallStack.begin ();
780
- auto InlCallStackIter = InlinedCallStack.begin ();
781
- for (; StackFrame != ProfileCallStack.end () &&
782
- InlCallStackIter != InlinedCallStack.end ();
783
- ++StackFrame, ++InlCallStackIter) {
784
- uint64_t StackId = computeStackId (*StackFrame);
785
- if (StackId != *InlCallStackIter)
786
- return false ;
787
- }
788
- // Return true if we found and matched all stack ids from the call
789
- // instruction.
790
- return InlCallStackIter == InlinedCallStack.end ();
778
+ return ProfileCallStack.size () >= InlinedCallStack.size () &&
779
+ llvm::equal (ProfileCallStack.take_front (InlinedCallStack.size ()),
780
+ InlinedCallStack, [](const Frame &F, uint64_t StackId) {
781
+ return computeStackId (F) == StackId;
782
+ });
791
783
}
792
784
793
785
static bool isAllocationWithHotColdVariant (const Function *Callee,
You can’t perform that action at this time.
0 commit comments