Landing: e90e0f66051d
Project / Subsystem
gcc / tree-optimization
Date
2026-09-07
Author
Shivam Gupta
Commit
e90e0f66051d338c1950d2cc9e36967552d75c3a
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- tree-optimization
- patch_id
- —
- commit_hash
- e90e0f66051d338c1950d2cc9e36967552d75c3a
- source_type
- github
- headline
- tree-optimization: Recognize CLZ loop for signed non-negative values.
- tldr
- Compiler now recognizes CLZ (count leading zeros) optimization for loops involving signed non-negative values.
- author
- Shivam Gupta
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • loop-optimization
- • signed-arithmetic
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-09-07T00:00:00.000Z
The compiler’s loop iteration counting has been improved to recognize Count Leading Zeros (CLZ) optimizations for loops that use signed arithmetic right shifts on non-negative values. Previously, a strict unsigned type check prevented this optimization. The change modifies the is_rshift_by_1 function and adds non-negativity checks to loop iteration counting, enabling more efficient code generation for these cases.