[all-commits] [llvm/llvm-project] c8a70f: [CodeGen][StaticDataPartitioning]Place local-linka...

Mingming Liu via All-commits all-commits at lists.llvm.org
Fri Mar 28 16:32:08 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8a70f4c6e24076ac3fc18bfb9e2a41ece83e7fc
      https://github.com/llvm/llvm-project/commit/c8a70f4c6e24076ac3fc18bfb9e2a41ece83e7fc
  Author: Mingming Liu <mingmingl at google.com>
  Date:   2025-03-28 (Fri, 28 Mar 2025)

  Changed paths:
    A llvm/include/llvm/Analysis/StaticDataProfileInfo.h
    M llvm/include/llvm/CodeGen/Passes.h
    M llvm/include/llvm/InitializePasses.h
    M llvm/include/llvm/Passes/MachinePassRegistry.def
    M llvm/lib/Analysis/CMakeLists.txt
    A llvm/lib/Analysis/StaticDataProfileInfo.cpp
    M llvm/lib/CodeGen/CMakeLists.txt
    M llvm/lib/CodeGen/CodeGen.cpp
    A llvm/lib/CodeGen/StaticDataAnnotator.cpp
    M llvm/lib/CodeGen/StaticDataSplitter.cpp
    M llvm/lib/CodeGen/TargetPassConfig.cpp
    A llvm/test/CodeGen/X86/global-variable-partition.ll

  Log Message:
  -----------
  [CodeGen][StaticDataPartitioning]Place local-linkage global variables in hot or unlikely prefixed sections based on profile information (#125756)

In this PR, static-data-splitter pass finds out the local-linkage global
variables in {`.rodata`, `.data.rel.ro`, `bss`, `.data`} sections by
analyzing machine instruction operands, and aggregates their accesses
from code across functions.

A follow-up item is to analyze global variable initializers and count
for access from data.
* This limitation is demonstrated by `bss2` and `data3` in
`llvm/test/CodeGen/X86/global-variable-partition.ll`.

Some stats of static-data-splitter with this patch:

**section**|**bss**|**rodata**|**data**
:-----:|:-----:|:-----:|:-----:
hot-prefixed section coverage|99.75%|97.71%|91.30%
unlikely-prefixed section size percentage|67.94%|39.37%|63.10%

1. The coverage is defined as `#perf-sample-in-hot-prefixed <data>
section / #perf-sample in <data.*> section` for each <data> section.
* The perf command samples
`MEM_INST_RETIRED.ALL_LOADS:u:pinned:precise=2` events at a high
frequency (`perf -c 2251`) for 30 seconds. The profiled binary is built
as non-PIE so `data.rel.ro` coverage data is not available.
2. The unlikely-prefixed `<data>` section size percentage is defined as
`unlikely <data> section size / the sum size of <data>.* sections` for
each `<data>` section



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