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

Report failed block copies in backward threader

Failed block copies in GCC's backward threader are now reported, improving debugging of optimization path failures.

This commit enhances error reporting within GCC’s backward threader, specifically for failed block copies. Previously, when back_jt_path_registry::duplicate_thread_path failed, the registered path was silently dropped without indication. Now, such failures are reported through cancel_thread with a failure_reason, aligning with how other thread termination reasons are handled. This change, motivated by PR tree-optimization/126906, aids in diagnosing why optimization paths might be discarded.

In Details

The back_jt_path_registry::duplicate_thread_path function in tree-ssa-threadupdate.cc previously dropped failing block copies silently. This commit modifies it to accept a failure_reason argument and sets this reason upon exiting due to failure. The back_jt_path_registry::update_cfg function is updated to call cancel_thread with this reason when duplicate_thread_path fails. This provides explicit diagnostics for dropped thread paths, improving the debugging of tree-ssa optimization failures.

For Context
backward threader
A component within GCC's optimization passes that analyzes code flow by tracing execution paths backward from a target point.
block copy
In the context of optimization, copying a block of code or data. In this case, it likely refers to duplicating or updating a computed path.
tree-ssa
A GCC optimization pass that transforms the compiler's intermediate representation (GIMPLE) into Static Single Assignment (SSA) form, which simplifies many optimization algorithms.
PR tree-optimization/126906
A bug report filed against the tree-optimization pass of the GCC compiler, related to the reporting of failures in the backward threader's block copying mechanism.
Filed Under: optimizationdebuggingtree-ssa