Landing: a7a444ddd1eb
Project / Subsystem
gcc / match.pd
Date
2026-07-31
Author
Jakub Jelinek
Commit
a7a444ddd1eb51d755d613e5cc413548f6574b53
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- a7a444ddd1eb51d755d613e5cc413548f6574b53
- source_type
- github
- headline
- match.pd: Fix simplification for bitwise AND and XOR comparison
- tldr
- Corrects a simplification rule for bitwise operations involving equality checks on truth-valued operands.
- author
- Jakub Jelinek
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • compiler
- • optimization
- • pattern matching
- • bit-int
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-31T00:00:00.000Z
This commit fixes a miscompilation caused by an incorrect simplification rule in match.pd. The rule (a & b) == (a ^ b) -> !(a | b) was applied too broadly, especially when operands had different types or were not strictly boolean. The fix ensures the simplification correctly handles type conversions and uses bitwise NOT (~) for 1-bit precision types while employing XOR with 1 for wider types, thus preserving correctness.