aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ModuleManager.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-06-01 08:09:58 -0700
committerGitHub <noreply@github.com>2025-06-01 08:09:58 -0700
commit2425626d803002027cbf71c39df80cb7b56db0fb (patch)
treed1571d648a02cfce1dcfc6f24600545adc57d9ba /clang/lib/Serialization/ModuleManager.cpp
parentde7f2fbc0c6640241c04ce846760edf3893b8671 (diff)
downloadllvm-2425626d803002027cbf71c39df80cb7b56db0fb.zip
llvm-2425626d803002027cbf71c39df80cb7b56db0fb.tar.gz
llvm-2425626d803002027cbf71c39df80cb7b56db0fb.tar.bz2
[memprof] Print alloc site matches immediately (#142233)
Without this patch, we buffer alloc site matches in FullStackIdToAllocMatchInfo and then print them out at the end of MemProfUsePass. This practice is problematic when we have multiple matches per alloc site. Consider: char *f1() { return new char[3]; } char *f2() { return f1(); } __attribute__((noinline)) char *f3() { return f2(); } In this example, f1 contains an alloc site, of course, but so do f2 and f3 via inlining. When something like this happens, FullStackIdToAllocMatchInfo gets updated multiple times for the same full stack ID at: FullStackIdToAllocMatchInfo[FullStackId] = { ... }; with different InlinedCallStack.size() each time. This patch changes the behavior by immediately printing out alloc site matches, potentially printing out multiple matches for the same FullStackId. It is up to the consumer of the message to figure out the length of the longest matches for example. For the test, this test adjusts an existing one, memprof-dump-matched-alloc-site.ll. Specifically, this patch "restores" the IR and corresponding profile for f2 and f1 so that the compiler generates a "MemProf notcold" message for each of f1, f2, and f3.
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
0 files changed, 0 insertions, 0 deletions