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

Skip GIMPLE_DEBUG stmts before assigning UIDs

GCC now skips GIMPLE_DEBUG statements before assigning UIDs, preventing them from disrupting VEC_PERM simplification and ensuring consistent optimization regar…

This commit fixes a bug where GIMPLE_DEBUG statements interfered with optimization passes by consuming Unique Identifiers (UIDs) prematurely. This consumption caused pending VEC_PERM simplify sequences to be flushed, making optimization results dependent on the presence of debug information. The fix ensures that debug statements are skipped before UID assignment and processing of ordinary statements, leading to more consistent optimization.

In Details

In tree-ssa-forwprop.cc, the pass_forwprop::execute method previously assigned UIDs to GIMPLE_DEBUG statements, which are then filtered out as non-assignments. This premature UID consumption and filtering disrupted VEC_PERM simplify sequences. The change modifies the pass to skip GIMPLE_DEBUG statements entirely before UID assignment and before processing regular statements, thus preventing them from affecting the simplification pipeline and ensuring deterministic optimization behavior.

For Context
GIMPLE
GCC's internal three-address intermediate representation (IR) used for optimization passes.
UID
Unique Identifier, a mechanism within GCC's intermediate representation to uniquely label statements or expressions.
VEC_PERM
A GCC internal representation node type, typically related to vector permutation operations, which is subject to simplification.
optimization pass
A distinct phase or transformation within the compiler's optimization pipeline that analyzes and modifies the intermediate representation.
Filed Under: optimizationbugfix