Landing: 7c25b09da584
Project / Subsystem
gcc / range-op.cc
Date
2026-08-17
Author
Daniel Barboza
Commit
7c25b09da5841ce372415a97c557509a8a0bb468
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- range-op.cc
- patch_id
- —
- commit_hash
- 7c25b09da5841ce372415a97c557509a8a0bb468
- source_type
- github
- headline
- Add division and modulo relation effects for equal operands
- tldr
- Optimizes division and modulo by zero when operands are equal.
- author
- Daniel Barboza
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • range-analysis
- • tree-optimization
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-17T00:00:00.000Z
This commit enhances range analysis by introducing relation effects for division and modulo operations when the operands are equal. Specifically, if a == b, then a / b is now known to result in 1, and a % b is known to result in 0. This optimization is applied earlier in the compilation process, potentially improving code generated by -O2 and later.