Add set_pairs to frange to install sub-ranges.
New frange::set_pairs function in GCC optimizes range representation by fusing sub-ranges.
GCC’s frange class gains a new set_pairs function to install a set of sub-ranges. This function sorts and fuses overlapping sub-ranges, capping the result at MAX_PAIRS. While preliminary statistics suggest two sub-ranges are sufficient for 99.6% of cases, the current implementation caps at one interval. This change is behind a switch, with no user-facing functionality altered yet.
In Details
The frange::set_pairs function in GCC's value-range analysis infrastructure handles installation of sub-ranges. It merges overlapping intervals, respecting a MAX_PAIRS limit. The implementation prioritizes simplicity over extreme efficiency for sub-range fusion, contrasting with irange. This change prepares for future optimizations related to range representation.
- frange
- A data structure in GCC used for representing and analyzing ranges of values, often in the context of optimization passes.
- sub-ranges
- Smaller, contiguous intervals that together constitute a larger, potentially non-contiguous, range of values. Used to represent complex value sets more precisely.
- fuses
- In the context of ranges, merging adjacent or overlapping intervals into a single, larger interval to simplify representation.
- convex hull
- The smallest convex set that contains a given set of points or intervals. For value ranges, it represents the minimum and maximum bounds encompassing all possible values.