GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Fix a bug in updating live info during rematerialization.

The compiler's register allocation phase now correctly handles multi-register pseudo-registers during rematerialization.

A bug was fixed in the LRA (Local Register Allocator) rematerialization pass where it failed to account for pseudo-registers requiring multiple hardware registers. This could lead to incorrect rematerialization decisions, but is now corrected to consider the correct number of registers.

In Details

The LRA rematerialization pass attempts to recompute values instead of spilling/restoring them, based on live range analysis. The bug was in lra-remat.cc's do_remat function, which now uses the correct nregs when updating live hard register information. Pseudo registers, which can require more than one hard register, were being mishandled.

For Context

This commit addresses a bug in the register allocation phase of the compiler. Register allocation is the process of assigning program variables to physical registers in the CPU. Rematerialization is a technique where the compiler recomputes a value instead of loading it from memory, which is faster. The bug caused the compiler to incorrectly track which registers were in use, leading to potentially incorrect code generation. The fix ensures that register allocation is performed correctly, which leads to more efficient code.

Filed Under: lraregister allocationrematerializationbugfix