GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
gcc/tree-optimization Performance Win

Use vrp_operand_equal_p for prange comparisons.

Optimized comparisons for prange objects by using a specialized function.

This commit changes how prange objects are compared for equality. Previously, raw pointer comparisons were used, which could lead to incorrect results when objects were unshared. The change introduces vrp_operand_equal_p for prange comparisons, ensuring that unshared objects are correctly identified as equal, which is crucial for data structures like hash tables.

In Details

This patch modifies value-range analysis in GCC's IPA passes. It replaces raw pointer equality checks for prange_storage objects with vrp_operand_equal_p. This is necessary because IPA's reassociation and unsharing of prange objects can lead to different physical pointers for semantically identical objects. Direct pointer comparison would break optimizations like hash table lookups, while vrp_operand_equal_p correctly handles semantic equality.

For Context
IPA
Inter-procedural Analysis, a phase in GCC that analyzes code across function boundaries to enable optimizations.
prange
A data structure used in GCC's value-range analysis to represent a range of possible values for a variable or expression.
vrp_operand_equal_p
A function within GCC's value-range analysis that compares two operands for equality, considering their value ranges and potential aliasing.
unsharing
In GCC's internal representation, unsharing refers to creating distinct copies of data structures that were previously shared, often to allow independent modification or optimization.
Filed Under: optimizationgcc