Implement exact nonzero-set test without nonzero_p.
Directly tests for the exact 'nonzero set' range, replacing the ambiguous `nonzero_p` function.
This commit replaces the use of the nonzero_p function with a direct test for the exact condition it was intended to represent: whether a range is precisely the set of all non-zero values. This change is applied in get_legacy_range and prange_storage to ensure accurate range analysis, particularly for the ~[0,0] range, which signifies all values except zero.
In Details
The prange_storage encoding and get_legacy_range function previously relied on nonzero_p() to identify the range ~[0,0]. This commit introduces a new predicate, nonzero_range_p, to perform this check directly, removing the dependency on the ambiguous nonzero_p(). This clarifies the intent and ensures correctness in how the specific range excluding only zero is handled within the value-range infrastructure.
- prange
- A data type within GCC's value-range analysis that represents a range of possible integer values. It's used to track the potential values of variables and expressions.
- nonzero_p
- A predicate function that previously indicated whether a given range of values excluded zero. Its behavior was sometimes ambiguous and has been superseded by more precise checks.
- range
- In the context of compiler optimization, a range represents the set of possible values that a variable or expression can take. This can be a continuous interval (e.g., [0, 10]) or a specific set of values.