[llvm] [BOLT][AArch64] Preserve external branches to non-function symbols (PR #227275)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 04:18:44 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Alexandros Lamprineas (labrinea)

<details>
<summary>Changes</summary>

Record the ELF type of input relocation symbols. Branches to non-function symbols can carry live IP0/IP1, so keep them as external branches instead of converting them to tail calls. Preserve tail-call handling for PLT entries, whose undefined symbols may also have STT_NOTYPE.

Lower conditional external exits through local transfer blocks and retain their profile counts through FDATA and YAML. Experimental relaxation can then use B-only thunks without clobbering live IP0/IP1.

Make AArch64 branch analysis decline blocks ending in an external exit. Their target has no local CFG successor; reporting incomplete analysis as success caused branch fixup to add a redundant local jump after a conditional branch.

Add AArch64 tests for function-body targets, symbol aliases, conditional exits, and a split block with a local conditional followed by an external branch.

Assisted-by: Codex

---
Full diff: https://github.com/llvm/llvm-project/pull/227275.diff


20 Files Affected:

- (modified) bolt/include/bolt/Core/BinaryFunction.h (+6-6) 
- (modified) bolt/include/bolt/Core/BinarySection.h (+2-1) 
- (modified) bolt/include/bolt/Core/MCPlus.h (+1) 
- (modified) bolt/include/bolt/Core/MCPlusBuilder.h (+6) 
- (modified) bolt/include/bolt/Core/Relocation.h (+9-3) 
- (modified) bolt/lib/Core/BinaryFunction.cpp (+95-73) 
- (modified) bolt/lib/Core/BinaryFunctionProfile.cpp (+3-4) 
- (modified) bolt/lib/Core/MCPlusBuilder.cpp (+8) 
- (modified) bolt/lib/Passes/Inliner.cpp (+6) 
- (modified) bolt/lib/Passes/LongJmp.cpp (+4-2) 
- (modified) bolt/lib/Profile/DataReader.cpp (+9-5) 
- (modified) bolt/lib/Profile/StaleProfileMatching.cpp (+4-1) 
- (modified) bolt/lib/Profile/YAMLProfileReader.cpp (+8-3) 
- (modified) bolt/lib/Profile/YAMLProfileWriter.cpp (+6-2) 
- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+3-1) 
- (modified) bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp (+7-3) 
- (added) bolt/test/AArch64/branch-target-symbol-type-alias.S (+85) 
- (added) bolt/test/AArch64/conditional-branch-target-symbol-type.S (+108) 
- (added) bolt/test/AArch64/external-branch-local-conditional-split.S (+44) 
- (added) bolt/test/AArch64/tail-classified-body-branch-live-x16.S (+133) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


https://github.com/llvm/llvm-project/pull/227275


More information about the llvm-commits mailing list