[MemProf] Recognize hot/cold operator new as replaceable allocations
authorTeresa Johnson <tejohnson@google.com>
Mon, 1 May 2023 18:04:59 +0000 (11:04 -0700)
committerTeresa Johnson <tejohnson@google.com>
Mon, 1 May 2023 20:37:40 +0000 (13:37 -0700)
commit2cc0c0de802178dc7e5408497e2ec53b6c9728fa
tree03be4e79e94f4af3d4eb87a58c9de0847de38ed4
parentd366da97bd24ddfb91c9f260fa0aaf105d947652
[MemProf] Recognize hot/cold operator new as replaceable allocations

Follow up to LLVM-side change to allow conversion to hot/cold hinted
operator new, not yet standard but supported by open source tcmalloc.
The LLVM change in a35206d78280e0ebcf48cd21bc5fff5c3b9c73fa added the
necessary support to recognize these as library functions, and we
subsequently found that a clang-side change is needed to give them
builtin/nobuiltin attributes as appropriate so they have consistent
removeability.

Based on discussion with Richard Smith, converted the parameter type to
a reserved identifier (39f7b48671dae5fbe3afc49f33f50c2b6340bb89) and
added support in this patch to recognize it in clang.

Differential Revision: https://reviews.llvm.org/D149600
clang/lib/AST/Decl.cpp
clang/test/CodeGenCXX/new_hot_cold.cpp [new file with mode: 0644]