Skip to content

Mark TCMalloc hot/cold allocation entry points with ABSL_ATTRIBUTE_HOT. - #1987

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_982514531
Dec 5, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_982514531

Conversation

@copybara-service

Copy link
Copy Markdown

Mark TCMalloc hot/cold allocation entry points with ABSL_ATTRIBUTE_HOT.

TCMalloc's __hot_cold_t allocation entry points only receive traffic when MemProf hot/cold hinting is enabled. Instrumentation FDO binaries build without MemProf, and AutoFDO profiles can predate MemProf enablement, so both can record zero counts for these entry points. Optimizers then treat them as cold, applying cold-function heuristics such as disabling tail-call elimination on allocation fast paths.

LLVM's ProfileSummaryInfo now honors the hot function attribute over profile counts (llvm/llvm-project@be7aacd). Annotate all __hot_cold_t allocation entry points in tcmalloc.cc with ABSL_ATTRIBUTE_HOT so they stay hot even when unexecuted in the profile. This covers the operator new and operator new[] overloads, TCMallocInternalNew*HotCold* functions, size-returning hot/cold functions, and DEFINE_ALLOC_TOKEN_NEW_EXTENSION variants.

@google-cla

google-cla Bot commented Dec 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

TCMalloc's `__hot_cold_t` allocation entry points only receive traffic when MemProf hot/cold hinting is enabled. Instrumentation FDO binaries build without MemProf, and AutoFDO profiles can predate MemProf enablement, so both can record zero counts for these entry points. Optimizers then treat them as cold, applying cold-function heuristics such as disabling tail-call elimination on allocation fast paths.

LLVM's `ProfileSummaryInfo` now honors the `hot` function attribute over profile counts (llvm/llvm-project@be7aacd). Annotate all `__hot_cold_t` allocation entry points in `tcmalloc.cc` with `ABSL_ATTRIBUTE_HOT` so they stay hot even when unexecuted in the profile. This covers the `operator new` and `operator new[]` overloads, `TCMallocInternalNew*HotCold*` functions, size-returning hot/cold functions, and `DEFINE_ALLOC_TOKEN_NEW_EXTENSION` variants.

PiperOrigin-RevId: 1037097974
@copybara-service
copybara-service Bot merged commit c50cc42 into master Dec 5, 2026
14 of 15 checks passed
@copybara-service
copybara-service Bot deleted the test_982514531 branch December 5, 2026 16:03

This branch was successfully deployed

1 active deployment
github-pages — c50cc421 Deployed Dec 5, 2026 by github-pages[bot] via deploy #3334
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants