[all-commits] [llvm/llvm-project] c8e2f4: [MemProf] Select largest of matching contexts from...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Fri Oct 31 06:48:24 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8e2f433798d81304a3a248e0b15098fc4779896
      https://github.com/llvm/llvm-project/commit/c8e2f433798d81304a3a248e0b15098fc4779896
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2025-10-31 (Fri, 31 Oct 2025)

  Changed paths:
    M llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
    A llvm/test/Transforms/PGOProfile/memprof_diff_inline.ll
    M llvm/test/Transforms/PGOProfile/memprof_loop_unroll.ll

  Log Message:
  -----------
  [MemProf] Select largest of matching contexts from profile (#165338)

We aren't currently deduplicating contexts that are identical or nearly
identical (differing inline frame information) when generating the
profile. When we have multiple identical contexts we end up
conservatively marking it as non-cold, even if some are much smaller in
terms of bytes allocated.

This was causing us to lose sight of a very large cold context, because
we had a small non-cold one that only differed in the inlining (which we
don't consider when matching as the inlining could change or be
incomplete at that point in compilation). Likely the smaller one was
from binary with much smaller usage and therefore not yet detected as
cold.

Deduplicate the alloc contexts for a function before applying the
profile, selecting the largest one, or conservatively selecting the
non-cold one if they are the same size.

This caused a minor difference to an existing test
(memprof_loop_unroll.ll), which now only gets one message for the
duplicate context instead of 2. While here, convert to the text version
of the profile.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list