GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cprop Performance Win

cprop: Substitute the setter into the jump once per block.

Constant propagation pass optimizes jump bypassing by substituting setters only once per block.

The constant propagation pass (cprop) has been optimized to improve performance when bypassing conditional jumps. Previously, it would repeatedly substitute the source of a SETCC instruction into jump conditions for each incoming edge, leading to unnecessary RTL allocations and performance degradation. This change modifies bypass_block to perform the substitution only once per block before iterating over edges, significantly reducing memory allocation and compile time for code with many conditional jumps.

In Details

The cprop pass's bypass_block function has been optimized to reduce redundant RTL allocations. Previously, it substituted the source of SETCC into jump conditions for every incoming edge and register it considered. This repeated substitution, especially in code with many conditional jumps, caused excessive memory allocation. The fix introduces a change where the substitution occurs only once, before the loop iterating over incoming edges. If the known register value determines the jump, the subsequent substitutions within the loop now return an existing arm without new allocation. This…

For Context
cprop
Constant Propagation. A compiler optimization that replaces variables or expressions with their known constant values.
RTL
Register Transfer Language. An intermediate representation used by GCC to represent code before it is translated into machine code.
SETCC
Set Condition Code. An instruction that sets the processor's condition code flags based on the result of a comparison or arithmetic operation.
Basic Block
A sequence of instructions with a single entry point and a single exit point. Control flow enters at the beginning and proceeds without halt or possibility of diversion until the end.
Control Flow Graph
A graphical representation of the possible paths of execution in a program. Nodes represent basic blocks, and edges represent jumps or control flow transfers.
Filed Under: optimizationcpropRTL