Landing: 56efa4a73978
Project / Subsystem
gcc / match.pd
Date
2026-09-27
Author
Samarth Tandale
Commit
56efa4a739786bb1c1c6dcdab0ad81cb1c55b970
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- 56efa4a739786bb1c1c6dcdab0ad81cb1c55b970
- source_type
- github
- headline
- Optimize bitwise operations involving popcount.
- tldr
- New patterns fold bitwise OR/AND operations involving popcount for better optimization.
- author
- Samarth Tandale
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • pattern matching
- • popcount
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-09-27T00:00:00.000Z
The match.pd file gains new optimization patterns that fold certain bitwise OR and AND operations involving popcount. Specifically, (a != 0) | (popcount(a) == n) is folded into (a != 0) | (n == 0), and (a == 0) & (popcount(a) != n) into (a == 0) & (n != 0). This simplifies expressions where the result is determined by the non-zero status of a and a popcount comparison.