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

ifcvt: Track register availability in the parallel cost estimate

Improved parallel cost estimation in if-conversion by accurately tracking register dependencies.

This commit enhances the parallel cost estimation used in GCC’s if-conversion optimization by accurately tracking register availability. Previously, the cost model could retain dependencies on overwritten register values and miss inputs not directly in SET sources. The update uses register properties and an availability map to precisely determine dependency levels, ensuring that register overwrites are handled correctly. This leads to more accurate cost estimations, especially for complex instruction sequences, and is a prerequisite for improving if-conversion profitability on architectures like AArch64.

In Details

The noce_parallel_seq_cost function within GCC's if-conversion framework previously computed dependency levels by scanning all earlier definitions for each input register. This approach failed to correctly account for register reuse and dependencies arising from uses outside of SET operations, such as USE within PARALLEL constructs. This patch refactors the dependency tracking mechanism. It now employs vec_rtx_properties to gather register references and a register_map to maintain availability status. Definitions are recorded after their inputs are read, and a definition overwrite…

For Context
if-conversion
A compiler optimization technique that transforms conditional control flow (like if-else statements) into data flow using conditional instructions (like conditional selects) to potentially improve performance by reducing branch prediction misses.
parallel cost estimate
An estimation of instruction sequence cost that considers the processor's ability to execute instructions in parallel, accounting for pipeline depth and issue width.
register availability map
A data structure used by the compiler to track which registers are currently holding valid data and which are free to be allocated or overwritten.
GIMPLE
GCC's internal representation (IR) for code, designed to be a three-address, pseudo-code like intermediate language.
RTX
Representation of intermediate language in GCC, a low-level internal format used by the compiler.
Filed Under: if-conversionoptimizationgccperformance