Kazu Hirata b488ce0a67
[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.
2025-03-04 21:09:40 -08:00
..