Landing: f48c10c6c7bd
Project / Subsystem
gcc / gcc
Date
2026-06-08
Author
Naveen
Commit
f48c10c6c7bda00d913dd06803e1519d1301801b
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc
- patch_id
- —
- commit_hash
- f48c10c6c7bda00d913dd06803e1519d1301801b
- source_type
- github
- headline
- Folds (type)(minmax((wide)a, (wide)b)) to minmax(a, b)
- tldr
- This commit adds a new pattern to GCC's `match.pd` to fold widened min/max integer expressions back to their original types, improving optimization before vect…
- author
- Naveen
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • tree-ssa
- • vectorization
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-06-08T00:00:00.000Z
GCC’s match.pd now includes an optimization that folds minmax expressions where operands are initially widened to a larger integer type and then the result is cast back to the original type. For example, (uint32_t) MAX_EXPR <(uint64_t) a, (uint64_t) b> can now be simplified to MAX_EXPR <a, b>. This folding occurs when the widening preserves signedness, effectively optimizing these expressions before they reach the vectorizer, thereby potentially altering vectorization outcomes.