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

phiopt: Trigger CFG cleanup when cselim-limited makes changes.

The phiopt pass now triggers control flow graph cleanup when the cselim-limited optimization makes changes, preventing empty basic blocks.

The phiopt pass now sets the cfgchanged flag when the cselim-limited optimization performs modifications. This ensures that a control flow graph (CFG) cleanup pass is triggered, removing any empty basic blocks that may be left behind by cselim-limited. This prevents the creation of empty basic blocks.

In Details

pass_phiopt::execute now sets cfgcleanup if cselim_limited returns true, ensuring CFG cleanup when cselim_limited makes changes during phiopt. This prevents empty basic blocks from being left behind. The interaction with the CFG cleanup pass is important for maintaining a clean and optimized IR.

For Context

The phiopt pass in GCC optimizes code by simplifying PHI nodes, which are used to merge values from different control flow paths at a basic block. cselim-limited is a sub-optimization within phiopt that attempts to eliminate conditional select instructions. This commit ensures that after cselim-limited makes changes, a cleanup pass is run to remove any resulting empty basic blocks, thus maintaining a well-formed control flow graph for later optimization stages.

Filed Under: optimizationphi nodescontrol flow graph