Landing: 1c9808a71207
Project / Subsystem
gcc / match.pd
Date
2026-05-20
Author
Shivam Gupta
Commit
1c9808a71207eb217f4e190c60f2755a796b90d4
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- 1c9808a71207eb217f4e190c60f2755a796b90d4
- source_type
- github
- headline
- Simplify (T)(x) == (T)(y) to (T)(x ^ y) == 0 in match.pd
- tldr
- The compiler now simplifies equality comparisons between narrowed integral types by converting them into XOR operations against zero.
- author
- Shivam Gupta
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • pattern-matching
- • tree-ssa
- • integral
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-20T00:00:00.000Z
The compiler can now transform equality comparisons of the form (T)(x) == (T)(y) into (T)(x ^ y) == 0, where T is an integral type with precision less than that of x and y. This optimization applies to both equality and inequality comparisons. The change improves code generation for cases where boolean or short values are compared after implicit conversion.