GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ext-dce

ext-dce: Mark spanned hard registers live for multi-reg references

ext-dce now correctly handles multi-register hard registers, preventing premature elimination of preceding code.

The extended dead code elimination (ext-dce) pass now correctly marks all spanned hard registers as live when references involve multiple registers. This fixes a bug where ext-dce failed to account for all registers in multi-register references, leading to the incorrect elimination of valid code, as reported in PR127367.

In Details

In ext-dce.cc, the ext_dce_process_uses function is updated to correctly handle multi-register hard registers, such as (reg:TI a0) used in function calls on RISC-V64. Previously, it failed to record all spanned registers (e.g., a1) in livenow, causing incorrect elimination of preceding RTL extensions. The fix iterates through all spanned hard registers using end_hard_regno to ensure all their chunks are marked live for HARD_REGISTER_P checks.

For Context
ext-dce
Extended Dead Code Elimination. A GCC optimization pass that removes code that does not affect the program's output or state.
Hard Register
A physical hardware register available on the target CPU architecture.
Multi-register reference
A reference to a value that is stored across multiple consecutive hard registers, often used for larger data types or function call arguments/return values.
RTL
Register Transfer Language. An intermediate representation used by GCC to represent program code during optimization and before code generation.
livenow
A data structure or variable within GCC's optimization passes that tracks which registers are currently in use (live) at a particular point in the code.
Filed Under: optimizationdead-code-eliminationrtl