GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
range-op

range-op: Implement relation handling for AND, OR, MIN, and MAX.

Range operations now support relation handling for AND, OR, MIN, and MAX, enabling new simplifications when operands are equal or ordered.

The range-operation library has been extended to implement relation handling for bitwise AND, OR, MIN, and MAX operations. When operands are equal, AND and OR operations simplify to the operand itself. When x <= y, MIN(x,y) simplifies to x, and when x >= y, MAX(x,y) simplifies to x. These improvements, identified during an audit of the DOM pass, will enable further simplifications by moving logic into range-ops.

In Details

GCC's range-op infrastructure gains lhs_op1_relation and lhs_op2_relation support for operator_bitwise_and, operator_bitwise_or, operator_min, and operator_max. This enables folding cases like x & y to x when x == y, x | y to x when x == y, min(x, y) to x when x <= y, and max(x, y) to x when x >= y. This functionality is being extracted from DOM.

For Context
range-op
A component within GCC that deals with operations on ranges of values, used for optimizations like Value Range Propagation (VRP).
relation handling
The process by which compiler optimization passes determine and utilize relationships (like equality, inequality, or order) between variables or expressions.
DOM
Dominator Tree. A tree structure representing the control flow graph of a program, used in various optimization passes. This commit moves some logic out of DOM.
VREL_EQ
A value relation indicating that two entities are equal.
VREL_LE
A value relation indicating that the first entity is less than or equal to the second.
Filed Under: optimizationcompiler