aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-11-07 14:40:00 -0800
committerGitHub <noreply@github.com>2024-11-07 14:40:00 -0800
commite189d61924ba0165b3a344c3d945b3e2aa373485 (patch)
treefb66130aa5a8bfb02c76d70ea6d2959463a9d7a3 /clang/lib/Serialization/ASTWriterDecl.cpp
parent02668f60a9b5c0d5b8b6e60b4e897f763ad59a91 (diff)
downloadllvm-e189d61924ba0165b3a344c3d945b3e2aa373485.zip
llvm-e189d61924ba0165b3a344c3d945b3e2aa373485.tar.gz
llvm-e189d61924ba0165b3a344c3d945b3e2aa373485.tar.bz2
[memprof] Add extractCallsFromIR (#115218)
This patch adds extractCallsFromIR, a function to extract calls from the IR, which will be used to undrift call site locations in the MemProf profile. In a nutshell, the MemProf undrifting works as follows: - Extract call site locations from the IR. - Extract call site locations from the MemProf profile. - Undrift the call site locations with longestCommonSequence. This patch implements the first bullet point above. Specifically, given the IR, the new function returns a map from caller GUIDs to lists of corresponding call sites. For example: Given: foo() { f1(); f2(); f3(); } extractCallsFromIR returns: Caller: foo -> {{(Line 1, Column 3), Callee: f1}, {(Line 2, Column 3), Callee: f2}, {(Line 2, Column 9), Callee: f3}} where the line numbers, relative to the beginning of the caller, and column numbers are sorted in the ascending order. The value side of the map -- the list of call sites -- can be directly passed to longestCommonSequence. To facilitate the review process, I've only implemented basic features in extractCallsFromIR in this patch. - The new function extracts calls from the LLVM "call" instructions only. It does not look into the inline stack. - It does not recognize or treat heap allocation functions in any special way. I will address these missing features in subsequent patches.
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
0 files changed, 0 insertions, 0 deletions