Enable sub-ranges for frange optimization.
GCC's frange optimization now supports two sub-ranges, improving range representation and enabling new optimizations.
GCC’s frange optimization pass has been enhanced to support two sub-ranges, up from one. This change allows for better representation of inequalities such as non-zero values, which were previously missed. With two sub-ranges, the optimization now captures 99.63% of ranges encountered in a Fortran corpus, significantly closing the gap with internal tables used by DOM. This improvement is expected to fix several open PRs related to nonzero folding and signed zero optimizations, while also yielding modest gains in jump threading and constant propagation opportunities.
In Details
The frange pass, which deals with scalar evolution and range analysis, has increased its capacity to represent complex range conditions by raising MAX_PAIRS from 1 to 2. This allows for the representation of compound conditions like 'x != 0' which previously required DOM's internal tables. The change aims to improve VRP constant propagation and jump threading by providing more accurate range information, ultimately improving code generation quality.