Landing: 5c62a2771f2c
Project / Subsystem
gcc / match.pd
Date
2026-07-31
Author
Jakub Jelinek
Commit
5c62a2771f2c7d5301ee6456f1817098c2fea113
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- 5c62a2771f2c7d5301ee6456f1817098c2fea113
- source_type
- github
- headline
- match.pd: Fix simplification for bit shifts and AND operations
- tldr
- Corrects a simplification rule for expressions involving bit shifts and bitwise AND.
- 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 corrects a simplification rule in match.pd that handles expressions like ((C << A) & D) != 0. The previous rule incorrectly folded the expression to false or true based on a simple comparison of shift counts and mask values, without properly considering the type of the shift count. The fix ensures that if the difference between the constants (used in the shift comparison) does not fit within the type of the shift count operand, the simplification correctly deduces that the result is always false or true, preventing miscompilations.