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

DCE fixes call removal condition for no_delete.

Dead Code Elimination now correctly handles calls marked as 'no_delete'.

The Dead Code Elimination (DCE) pass in GCC has been fixed to correctly handle calls that are marked as no_delete. Previously, a flawed conditional check allowed the left-hand side (LHS) of such calls to be removed, leading to incorrect code generation. This patch ensures that the LHS of calls with the no_delete attribute is not removed, preserving necessary operations.

In Details

This commit rectifies an incorrect conditional in simple_dce_from_worklist within the tree-ssa-dce pass. The no_delete flag, intended to prevent the removal of certain statements, was not being properly checked when considering the removal of the LHS of a call instruction. This oversight could lead to the DCE pass incorrectly removing essential parts of a call, potentially violating invariants or optimizations related to the no_delete attribute. The fix ensures that the no_delete check is correctly applied before any attempt to remove the LHS of a call.

For Context
Dead Code Elimination (DCE)
A compiler optimization pass that removes code that does not affect the program's output or behavior. This can reduce code size and improve performance by eliminating unnecessary computations.
SSA
Static Single Assignment form. An intermediate representation where every variable is assigned a value exactly once. SSA is widely used in optimizing compilers.
no_delete
A flag or attribute that signifies a particular statement or operation should not be removed by optimization passes like Dead Code Elimination, often due to specific requirements for side effects or program correctness.
LHS
Left-Hand Side. In an assignment statement (e.g., x = y + 1), the LHS is the variable being assigned to (x). In the context of a call, it refers to the variable that would receive the return value.
Filed Under: dceoptimizationcorrectness