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

Simplify PRE phi-translation expression simplification.

Ensures correct handling of SSA names during PRE phi-translation to avoid incorrect simplifications.

This commit corrects expression simplification in the PRE (Partial Redundancy Elimination) pass’s phi-translation. Previously, limitations on what SSA names were allowed were ineffective, leading to the encoding of previously rejected names. The fix restores the original unsimplified NARY representation when simplification to an SSA name would be invalid, addressing a bug reported in PR126965.

In Details

The tree-ssa-pre.cc file handles PRE optimization. The phi_translate_1 function simplifies expressions involving PHI nodes. This commit enhances get_or_alloc_expr_for_nary to assert that SSA names or constants are not encoded as NARY. It also modifies phi_translate_1 to save and restore the translated NARY value, preventing incorrect simplifications to SSA names that were previously rejected.

For Context
PRE
Partial Redundancy Elimination. A compiler optimization pass that identifies and eliminates redundant computations within a program.
PHI translation
A process within SSA (Static Single Assignment) form where PHI nodes, which merge values from different control flow paths, are translated into expressions. This is often part of optimization passes like PRE.
SSA name
In Static Single Assignment (SSA) form, a variable is renamed each time it is assigned a value. An SSA name refers to a specific version of a variable, ensuring each has a single definition.
NARY
Represents a general tree node in GCC's internal representation (GIMPLE) that can have multiple children, often used for complex expressions or operations.
Filed Under: optimizationcompiler bug