GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-optimization

Backward threader handles abnormal PHIs

Improves the backward threader to correctly handle SSA names within abnormal PHI nodes, enabling better optimization for computed gotos.

The backward threader in GCC now correctly handles SSA names that appear in abnormal PHI nodes. Previously, it refused to process these, hindering optimizations like threading computed gotos where the destination might be part of an abnormal PHI. This change aligns with gimple_range_ssa_p’s ability to process such names, improving the path solver’s accuracy and enabling optimizations in complex control flow scenarios. New test cases verify the fix.

In Details

The backward threader now follows abnormal PHIs. Previously, it restricted itself to normal PHIs. This commit removes that restriction, allowing it to resolve SSA names in abnormal PHIs when the control flow path does not involve abnormal edges. This is safe because the path solver only considers normal predecessor edges. This fixes issues with computed gotos targeting blocks that are also targets of abnormal control flow, as seen in PR tree-optimization/126103.

For Context
Backward threader
A component within GCC's optimizers that traces control flow paths backward to determine how values propagate.
SSA name
In GCC's Static Single Assignment (SSA) form, an SSA_NAME represents a variable that has been assigned a value exactly once. It's a core concept for many compiler optimizations.
PHI node
A construct in SSA form that merges values from different control flow paths. A PHI node indicates which value of a variable should be used based on which predecessor block was executed.
Abnormal PHI
A PHI node where one of the incoming edges from a predecessor block is considered 'abnormal'. This typically relates to control flow constructs like computed gotos or exceptions.
Computed goto
A control flow statement where the target of a goto is determined dynamically at runtime, usually by loading an address into a register and then jumping to it.
Filed Under: optimizationgcccontrol flow