GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cfgrtl Performance Win

cfgrtl allows duplicated tablejumps to share dispatch tables

RTL basic blocks ending in tablejumps can now be duplicated, with multiple copies sharing a single dispatch table.

This commit modifies the cfgrtl component to allow duplicated RTL basic blocks that end in tablejumps to share a single dispatch table. Previously, such blocks could not be duplicated reliably because the instructions computing the table address might be outside the block. Now, an opted-in pass can mark a table with the JUMP_TABLE_SHARED_P flag, enabling multiple dispatches to reference the same immutable table. The pass ensures the table remains accessible by moving it if the block it originally followed is deleted, and correctly handles shared tables in various RTL operations.

In Details

This commit introduces the PROP_rtl_allow_tablejump_duplication function property, enabling passes to duplicate RTL basic blocks ending in tablejump instructions. When this property is set, a single jump table can be shared among duplicated blocks by marking it with the sticky JUMP_TABLE_SHARED_P flag. The implementation guards against issues like block deletion, incorrect address computation, and interblock scheduling complexities associated with shared tables. It ensures that the table remains valid by moving it if its associated block is deleted and updates RTL redirection, deletion,…

For Context
RTL
Register Transfer Language. An intermediate representation used by GCC to describe the code being compiled, typically after initial machine-independent optimizations.
basic block
A sequence of instructions with a single entry point and a single exit point. Control flow only enters at the beginning and leaves at the end.
tablejump
An RTL construct representing a jump executed via a jump table.
dispatch table
A data structure, often an array, that contains addresses or offsets to target code locations. Used for efficient multi-way branching.
JUMP_TABLE_SHARED_P
A flag indicating that a jump table is shared among multiple dispatch sites and should be treated as immutable.
Filed Under: cfgrtlrtloptimization