[llvm] [BOLT][AArch64] Add support for conditional tail calls in cold code (PR #227693)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 05:23:44 PDT 2026


andreasmullen wrote:

> Could we consolidate the lit tests into `condbr19-tailcall` and `tstbr14-tailcall`?
> 
> * Cover b.cond, cbz, and cbnz in the CONDBR19 test; tbz and tbnz in the TSTBR14 test. Keep the simple _start → foo source, and use fdata to make BOLT relocate hot foo.
> * Use --lite in place of --skip-funcs=_start so _start stays in the original text. The checks can focus on the BOLT output; the separate NONBOLTED checks are unnecessary.
> * Give each file a near and far run group, with compact and noncompact runs in each. With no padding, check that each branch reaches relocated . Add padding after _start (1 MB for CONDBR19, 32 KB for TSTBR14) and check that it reaches the patched <foo.org.0> entry instead. Use --no-huge-pages and, for the tighter TSTBR14 layout, --section-start and --align-text.
> * Check the .bolt.org.text and .text disassembly headings and align the instruction checks like the compare-and-branch-* tests, so the old entry, branch sites, and relocated function are easy to follow.
> 
> For exact forward and backward signed limits, I’d add a unit test in `bolt/unittests/Core/BinaryContext.cpp` instead of lit. With a fixed PC and an OriginalInst containing a nonzero displacement, check canEncodeValue at both limits and just beyond them, then compare encodeValue(Type, Target, PC, OriginalInst) with the expected instruction word. That also verifies that encoding preserves the condition, register, and tested-bit fields.

I have just made these updates now, adding a new unit test (`Relocation.cpp`).

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


More information about the llvm-commits mailing list