[all-commits] [llvm/llvm-project] b488ce: [memprof] Improve call site matching (#129770)

Kazu Hirata via All-commits all-commits at lists.llvm.org
Tue Mar 4 21:10:01 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b488ce0a677b42179198ea00bc6e860baa9874e3
      https://github.com/llvm/llvm-project/commit/b488ce0a677b42179198ea00bc6e860baa9874e3
  Author: Kazu Hirata <kazu at google.com>
  Date:   2025-03-04 (Tue, 04 Mar 2025)

  Changed paths:
    M llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
    A llvm/test/Transforms/PGOProfile/memprof-call-site-at-alloc-site.ll

  Log Message:
  -----------
  [memprof] Improve call site matching (#129770)

Suppose we have a call instruction satisfying:

- AllocInfoIter != LocHashToAllocInfo.end()
- CallSitesIter != LocHashToCallSites.end()
- !isAllocationWithHotColdVariant(CI->getCalledFunction(), TLI)

In this case this patch, we would take:

  if (AllocInfoIter != LocHashToAllocInfo.end()

but end up discarding the opportunity because of the call to
isAllocationWithHotColdVariant.

This can happen in C++ code like:

  new Something[100];

which is lowered to two calls -- new and the constructor.

This patch fixes the problem by falling back to the call site
annotation if we have !isAllocationWithHotColdVariant.



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