Landing: a94d2d065efd
Project / Subsystem
gcc / gcc/ranger-fold
Date
2026-05-28
Author
Andrew Pinski
Commit
a94d2d065efd35473c113cfb38b87234218341a3
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc/ranger-fold
- patch_id
- —
- commit_hash
- a94d2d065efd35473c113cfb38b87234218341a3
- source_type
- github
- headline
- Ranger-fold: Avoid calling gimple_stmt_nonnegative_p with varying ranges.
- tldr
- Range folding now correctly handles varying ranges by setting the range to `[type_min, type_max]` instead of calling `gimple_stmt_nonnegative_p`.
- author
- Andrew Pinski
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • range analysis
- • gimple
- • ada
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-28T00:00:00.000Z
The range folding optimization now correctly handles varying ranges by setting the range to [type_min, type_max] when the precision is different from the type’s min/max values, avoiding an infinite recursion. Previously, it would call gimple_stmt_nonnegative_p, which always returned true for unsigned types, leading to incorrect range assumptions. This fix prevents potential recursion issues and may improve code generation, particularly for Ada.