GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-ssa-ccp Performance Win

tree-ssa-ccp: avoid copying lattice values and shift counts

Pass lattice values and shift counts by const reference to reduce copying.

The valid_lattice_transition function in tree-ssa-ccp.cc now takes its lattice value arguments by const reference, avoiding unnecessary copies of potentially large data structures. Additionally, the bit_value_binop function avoids copying a shift count when it’s not modified, directly using the input value instead. These changes improve efficiency without altering the compiler’s behavior.

In Details

This commit optimizes parameter passing in two functions within the Constant Propagation (CCP) pass. valid_lattice_transition now accepts its lattice value arguments (ccp_prop_value_t) by const reference to avoid copying these structures. bit_value_binop similarly avoids an unnecessary copy of a widest_int used as a shift count in one of its cases, directly using the parameter r2val.

For Context
CCP
Abbreviation for Constant Propagation. A compiler optimization pass that determines which variables hold constant values and replaces their uses with those constants.
lattice values
In dataflow analysis, lattice values represent the possible states or values a variable can hold at a particular point in the program. These can be complex structures used to track information across basic blocks.
widest_int
An arbitrary-precision integer type used in GCC for representing values that exceed the standard machine integer types. It is crucial for intermediate calculations in various optimization passes.
Filed Under: optimizationperformance