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

Remove unused nonzero_p function from value ranges.

The `nonzero_p` function has been removed as all its call sites now use `contains_zero_p` or specific checks.

The nonzero_p function, which checked if a value range excluded zero, has been removed from the GCC compiler’s value range analysis. All known call sites have been updated to use the more precise contains_zero_p function or other specialized checks. This cleanup simplifies the code and removes an obsolete function.

In Details

The nonzero_p predicate, which was present across various vrange types (irange, prange, frange, Value_Range), has been removed. Its functionality was ambiguous, only truly indicating a range that was precisely ~[0,0]. All its callers have been migrated to either the more explicit contains_zero_p() predicate or direct checks for zero exclusion, streamlining the value range analysis infrastructure.

For Context
value range analysis
A compiler optimization technique that determines the possible range of values a variable or expression can hold during program execution. This information can be used to eliminate redundant checks, simplify expressions, and improve code efficiency.
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.
contains_zero_p
A predicate function that checks if a given range of values includes zero. This provides a clearer and more direct check for the presence of zero within a range compared to the removed nonzero_p function.
Filed Under: optimizationrefactor