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

Range-ops: Improve range information derivation from comparisons

GCC's range-ops optimization now derives information from comparisons beyond just singletons, expanding its optimization capabilities.

The range-ops optimization pass in GCC has been enhanced to derive information from comparisons even when they don’t involve singletons at the edges. Previously, it was limited to scenarios like a == CST on the true edge. This update allows GCC to infer range information from more complex comparisons, such as recognizing a != 0 from a = b - c where b != c, thus improving constant propagation and dead code elimination.

In Details

In fur_source::register_outgoing_edges within gimple-range-fold.cc, the range-ops optimization no longer strictly requires a singleton comparison (a == CST) at the edge. It now allows deriving range information as long as the value is not undefined or varying. This broadens the applicability of range-based analysis, enabling optimizations in cases previously missed, such as inferring bounds from differences when operands are known not to be equal.

For Context
range-ops
A GCC optimization pass that analyzes and manipulates operations involving ranges of values, often related to constant propagation and bound analysis.
singleton
In this context, a comparison involving a single constant value, such as x == 5 or y < 10.
GIMPLE
GCC's Internal Mode Generalized Intermediate Representation. It's a three-address, low-level intermediate representation used for optimization passes within GCC.
constant propagation
An optimization technique where expressions with constant operands are evaluated at compile time, and their results replace the original expressions.
dead code elimination
An optimization that removes code that has no effect on the program's output or behavior.
Filed Under: optimizationrange analysis