Landing: 7ebe4eb29d8f
Project / Subsystem
gcc / optimize
Date
2026-07-29
Author
Kyrylo Tkachov
Commit
7ebe4eb29d8fc0167f98705b53b4fddb28f0cffb
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- optimize
- patch_id
- —
- commit_hash
- 7ebe4eb29d8fc0167f98705b53b4fddb28f0cffb
- source_type
- github
- headline
- match: Fold remainder comparison with its dividend.
- tldr
- Optimization to simplify X % Y == X comparisons by checking X < Y.
- author
- Kyrylo Tkachov
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • match
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-29T00:00:00.000Z
The match optimization pass now simplifies expressions of the form X % Y == X. For non-negative operands, this condition is true if and only if the dividend X is less than the divisor Y. This avoids an unnecessary division operation. The optimization is similar to the existing rule for (X / Y) == 0 and preserves exceptions for potential zero divisors.