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

phiopt: Improve heuristics for factoring out loads before vectorization

PHIOPT pass in GCC improves load commoning heuristics to enable more loop vectorization opportunities.

The PHIOPT pass in GCC now uses improved heuristics for commoning loads before the vectorizer runs. Previously, many common loads were rejected due to simple heuristics. This change allows loads from other loads to be factored out earlier, potentially enabling more code to be vectorized. Two test cases are now factored out in phiopt2, and one case was adjusted to preserve vectorization.

In Details

The phiopt pass, specifically the factor_out_conditional_load function in tree-ssa-phiopt.cc, has been updated to improve its heuristics for commoning loads. The change allows pointers that cannot be analyzed via scalar evolution (SCEV) to be considered for factoring out, enabling earlier commoning of loads than previously possible, before the main loop optimizers. This affects the interaction between scalar optimizations and loop vectorization.

For Context
PHIOPT
A GCC optimization pass that performs various optimizations related to PHI nodes and loop-invariant code motion, aiming to simplify control flow and improve the efficiency of loops.
Commoning
An optimization technique where redundant computations or memory accesses are identified and replaced with a single instance, whose result is then shared. This reduces code size and improves performance.
Vectorization
An optimization process that transforms code to operate on multiple data elements simultaneously using special vector instructions (SIMD). This can significantly speed up data-parallel computations.
Scalar Evolution (SCEV)
A GCC analysis technique that computes closed-form expressions for values that evolve arithmetically within loops. It's crucial for many loop optimizations, including vectorization and induction variable analysis.
Filed Under: optimizationvectorizationphiopt