GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
lra

LRA's get_dependent_filter correctly handles subregisters.

Local Register Allocation's (LRA) filter mechanism now properly accounts for subregisters, fixing potential issues in dependent analysis.

The Local Register Allocator (LRA) has been updated to correctly handle subregisters within its get_dependent_filter mechanism. Previously, the code would traverse subregisters without properly adjusting the register number, leading to incorrect analysis. This patch ensures that the actual hard register number is used, resolving potential problems where dependent filters could not be correctly evaluated.

In Details

This commit modifies lra-constraints.cc and ira-lives.cc to correctly handle subregisters in LRA's dependent filter processing, addressing issues related to PR112431. The get_dependent_filter function now uses simplify_subreg_regno to obtain the underlying hard register number, passing this accurate information to lra_get_dependent_filter. The code asserts that such simplification is always possible, preventing incorrect analyses where subregister traversal might have previously led to evaluation problems in dependent filters.

For Context
Local Register Allocator (LRA)
A component within GCC responsible for assigning physical machine registers to program variables within a small, localized region of code (a basic block or a few blocks). It operates after the instruction selection and before the final machine code emission.
subregister
A portion of a larger machine register. For example, the lower 32 bits of a 64-bit register might be accessible as a subregister.
dependent filter
In the context of register allocation, a mechanism that imposes constraints or dependencies on how registers can be allocated. A dependent filter might specify that if one register is used, another must also be used or avoided.
hard register
A physical, actual register available on the target CPU architecture, as opposed to an abstract or virtual register used internally by the compiler.
Filed Under: lraregister allocationsubregister