GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ivopts Performance Win

ivopts: Remove target_reg_cost from register pressure estimate.

Register pressure calculations for loop ivopts no longer use target_reg_cost, improving accuracy and simplifying register availability checks.

The ivopts pass has been updated to remove target_reg_cost from its register pressure estimations. This change ensures that the cost of storing loop invariants is more accurately reflected by the eventual spilling of those values. Additionally, the calculation for available registers no longer considers reserved target registers, as their specific usage is now less critical to the pressure estimate.

In Details

The ivopts pass in GCC's tree-ssa optimization pipeline refines loop invariant computations. This change modifies ivopts_estimate_reg_pressure by removing target_reg_cost and target_res_regs. Previously, target_reg_cost influenced the pressure calculation, and target_res_regs affected available register counts. Removing these simplifies the logic by focusing on spill costs and treating all registers more uniformly, which is safe because the pass's primary goal is to minimize spilling of loop invariants.

For Context
ivopts
A GCC optimization pass that identifies and hoists loop-invariant computations out of loops to reduce redundant calculations.
register pressure
A metric used by compilers to estimate how many registers are needed at a given point in the code. High register pressure can lead to spills (storing register values to memory), impacting performance.
loop invariant
An expression or value within a loop whose value does not change from one iteration to the next.
spilling
The process by which a compiler stores the value of a register into memory when there are no available registers to hold it, typically to make room for other values.
tree-ssa
An intermediate representation (IR) used by GCC. Static Single Assignment (SSA) form simplifies many compiler optimizations, and 'tree' refers to the high-level IR structure.
Filed Under: optimizationcompiler