[all-commits] [llvm/llvm-project] 84d32e: [NFC][ThinLTOBitcodeWriter] Add test for cfi.funct...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Tue Sep 15 15:01:39 PDT 2026


  Branch: refs/heads/users/vitalybuka/spr/lowertypetests-reorder-cfi-jump-table-entries-based-on-hotness
  Home:   https://github.com/llvm/llvm-project
  Commit: 84d32e4a542837b81f21ea3101ec90e258671b5d
      https://github.com/llvm/llvm-project/commit/84d32e4a542837b81f21ea3101ec90e258671b5d
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    A llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-functions-hotness.ll

  Log Message:
  -----------
  [NFC][ThinLTOBitcodeWriter] Add test for cfi.functions metadata hotness encoding

Add pre-commit test coverage establishing the baseline cfi.functions
metadata linkage operand values before implementing hotness encoding.

PR Stack:
* https://github.com/llvm/llvm-project/pull/220776
* https://github.com/llvm/llvm-project/pull/221043
* https://github.com/llvm/llvm-project/pull/221044
* ➤ https://github.com/llvm/llvm-project/pull/223843
* https://github.com/llvm/llvm-project/pull/223846
* https://github.com/llvm/llvm-project/pull/223848
* https://github.com/llvm/llvm-project/pull/221046

Assisted-by: Gemini

Pull Request: https://github.com/llvm/llvm-project/pull/223843


  Commit: 6ddba30a66faaa30faaa19dfad69dff158877322
      https://github.com/llvm/llvm-project/commit/6ddba30a66faaa30faaa19dfad69dff158877322
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
    M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
    M llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
    M llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-functions-hotness.ll

  Log Message:
  -----------
  [ThinLTOBitcodeWriter] Encode hotness into cfi.functions metadata

Encode basic block / entry profile count into the upper 6 bits of
the linkage operand in cfi.functions metadata. This allows LowerTypeTests
to order jump table entries by function hotness.

We only have 6 bits available in the linkage operand. Using a log2
compression loses precision, but it is sufficient for our application
because we only need a rough magnitude ordering to push the singularly
hottest target function to the end of the jump table; exact counts are
unnecessary.

PR Stack:
* https://github.com/llvm/llvm-project/pull/220776
* https://github.com/llvm/llvm-project/pull/221043
* https://github.com/llvm/llvm-project/pull/221044
* https://github.com/llvm/llvm-project/pull/223843
* ➤ https://github.com/llvm/llvm-project/pull/223846
* https://github.com/llvm/llvm-project/pull/223848
* https://github.com/llvm/llvm-project/pull/221046

Assisted-by: Gemini

Pull Request: https://github.com/llvm/llvm-project/pull/223846


  Commit: aa3a319a2bf864ef7495747f77b3116bcc410b8c
      https://github.com/llvm/llvm-project/commit/aa3a319a2bf864ef7495747f77b3116bcc410b8c
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness-summary.ll
    M llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness.ll

  Log Message:
  -----------
  [NFC][LowerTypeTests] Expand tests for CFI jump table hotness ordering

Expand pre-commit test coverage to establish the baseline CFI jump table
layout before implementing hotness-based reordering in
https://github.com/llvm/llvm-project/pull/221046.

We expand these tests to verify we accurately track hotness data
originating from `cfi.functions` metadata, BlockFrequencyInfo (BFI)
counts, and IR function attributes (hot/cold). By covering these inputs,
we ensure the correct hotness tier is propagated for layout decisions
across different profile sources and LTO targets.

These tests verify the baseline declaration-order layout where functions
within each strict type are placed without hotness consideration, making
the subsequent reordering diff explicit and easy to review.

PR Stack:
* https://github.com/llvm/llvm-project/pull/220776
* https://github.com/llvm/llvm-project/pull/221043
* https://github.com/llvm/llvm-project/pull/221044
* https://github.com/llvm/llvm-project/pull/223843
* https://github.com/llvm/llvm-project/pull/223846
* ➤ https://github.com/llvm/llvm-project/pull/223848
* https://github.com/llvm/llvm-project/pull/221046

Assisted-by: Gemini

Pull Request: https://github.com/llvm/llvm-project/pull/223848


  Commit: e0c3c27b44b71446a53a95dd6fb2da81861f9383
      https://github.com/llvm/llvm-project/commit/e0c3c27b44b71446a53a95dd6fb2da81861f9383
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
    M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
    M llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness-summary.ll
    M llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness.ll

  Log Message:
  -----------
  [LowerTypeTests] Reorder CFI jump table entries based on hotness

Order CFI jump table entries by function hotness. We use `cfi.functions`
metadata in ThinLTO, or `BlockFrequencyInfo` / function entry counts in
full LTO.

We want the hottest function to be optimized by the last entry thing for
SHT_LLVM_CFI_JUMP_TABLE. The linker deletes the final branch in the jump
table and moves the table directly before that target function so it
falls through.

This also ensures the jump table lands in a hot section (.text.hot)
instead of a cold section (.text.unlikely). Type contiguity is
preserved.

This PR reliably improves the performance of our server binary by 0.2%,
and some smaller binaries up to 5%.

PR Stack:
* https://github.com/llvm/llvm-project/pull/220776
* https://github.com/llvm/llvm-project/pull/221043
* https://github.com/llvm/llvm-project/pull/221044
* https://github.com/llvm/llvm-project/pull/223843
* https://github.com/llvm/llvm-project/pull/223846
* https://github.com/llvm/llvm-project/pull/223848
* ➤ https://github.com/llvm/llvm-project/pull/221046

Assisted-by: Gemini

Pull Request: https://github.com/llvm/llvm-project/pull/221046


Compare: https://github.com/llvm/llvm-project/compare/ab8f2c2c6b1b...e0c3c27b44b7

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