Landing: 53b803a0d48d
Project / Subsystem
gcc / gcc/range-op
Date
2026-08-12
Author
Daniel Barboza
Commit
53b803a0d48df023a11231f9c43917ca9e33279d
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc/range-op
- patch_id
- —
- commit_hash
- 53b803a0d48df023a11231f9c43917ca9e33279d
- source_type
- github
- headline
- Infer zero result for division when dividend is positive and smaller than positive divisor.
- tldr
- Compiler now deduces `A / B` is zero if `A` and `B` are positive and `A < B`.
- author
- Daniel Barboza
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • range analysis
- • division
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-12T00:00:00.000Z
This commit enhances the range analysis optimization pass by adding a new relation effect for the division operation. Specifically, when the compiler can determine that both the dividend (A) and the divisor (B) are positive, and that A is strictly less than B, it can now infer that the result of A / B will always be zero. This improves optimization by providing more precise value range information for division operations.