Landing: 1c71996e6e06
Project / Subsystem
gcc / gcc/match
Date
2026-07-29
Author
Kyrylo Tkachov
Commit
1c71996e6e067ab3ee26ae581bef037a77324a1a
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc/match
- patch_id
- —
- commit_hash
- 1c71996e6e067ab3ee26ae581bef037a77324a1a
- source_type
- github
- headline
- Optimize comparisons of masked values for improved code generation
- tldr
- Simplify comparisons involving masked arithmetic operations to generate more efficient code.
- author
- Kyrylo Tkachov
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • code generation
- • aarch64
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-29T00:00:00.000Z
This commit enhances the match.pd component to fold certain comparisons involving masked values and arithmetic operations. It transforms expressions like ((X + C1) & LOWMASK) ==/!= C2 into simpler forms, reducing the number of instructions generated. This optimization is particularly beneficial for code generation on architectures like AArch64, as demonstrated by a significant reduction in instruction count for a sample function. New tests are added to cover these folding rules.