GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/tree-ssa

Convert range_operator::fold_range to use sub-ranges

Improves floating-point range analysis by correctly handling gaps between sub-ranges.

The fold_range function in GCC’s floating-point range analysis has been updated to process operands as pairs of sub-ranges. This change ensures that gaps between sub-ranges are preserved, rather than folding the entire hull, leading to more precise range analysis. It also optimizes by folding the diagonal when operands are known to be equal, mirroring the behavior of integer range analysis.

In Details

The range_operator::fold_range in range-op-float.cc previously computed the hull of two input ranges. This commit modifies it to iterate over pairs of sub-ranges from each operand, compute their fold via rv_fold, and union the results. This preserves gaps between sub-ranges, similar to irange::fold_range. When operands are equal, it folds the diagonal (each sub-range against itself). This refactoring aims to improve the precision of Value Range Propagation (VRP) for floating-point types.

For Context
range_operator::fold_range
A function within GCC that computes the resulting range when a binary operation is applied to two input ranges.
sub-ranges
A portion of a larger range. In this context, a range might be composed of multiple disjoint sub-ranges, each with a lower and upper bound.
Value Range Propagation (VRP)
A compiler optimization pass that determines the possible range of values for variables at different points in the program, enabling further optimizations.
hull
In the context of ranges, the hull is the smallest continuous range that encompasses all the given points or sub-ranges.
Filed Under: optimizationfloating pointrange analysisbugfix