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

phiopt: Run condition replication in early optimization phase

Condition replication over PHI nodes now runs earlier in the optimization pipeline for improved code generation.

The replicate_conds_over_phis pass in the phiopt pass was previously gated by !early_p. This change removes that gate, allowing the pass to run during the early optimization phase as well. This adjustment, suggested by Jeff, aims to improve code generation by applying condition replication more broadly.

In Details

The replicate_conds_over_phis pass, part of GCC's tree-ssa-phiopt.cc, normally runs in the later stages of optimization. This commit moves its execution to also occur during the early_p phase, controlled by phiopt::execute. This change aims to leverage condition replication across PHI nodes earlier in the SSA optimization pipeline, potentially improving optimization results before further passes occur.

For Context
PHI node
A special construct in Static Single Assignment (SSA) form that represents the merging of values from different control flow paths. It selects one of its incoming values based on which path was taken to reach the node.
SSA form
Static Single Assignment form is an intermediate representation in compilers where every variable is assigned a value exactly once. This simplifies many optimizations by making data flow explicit.
phiopt
The GCC pass responsible for optimizing PHI nodes in the SSA representation, aiming to simplify or eliminate them, often through techniques like constant folding or value propagation.
early optimization phase
An earlier stage in the compiler's optimization pipeline, typically focusing on simpler and faster transformations before more complex, time-consuming optimizations are applied.
Filed Under: optimizationgcc