Landing: 3d83dd50bc9a
Project / Subsystem
gcc / gcc/match.pd
Date
2026-05-01
Author
Jeff Law
Commit
3d83dd50bc9aed347570e453dfa60f1a69ea4e5a
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc/match.pd
- patch_id
- —
- commit_hash
- 3d83dd50bc9aed347570e453dfa60f1a69ea4e5a
- source_type
- github
- headline
- Match.pd: Add pattern for `(A>>bool) == 0 -> (unsigned)A <= bool`.
- tldr
- The compiler can now transform `(A>>bool) == 0` into `(unsigned)A <= bool`, potentially improving performance.
- author
- Jeff Law
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • bit manipulation
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-01T00:00:00.000Z
A new pattern is added to match.pd that transforms (A>>bool) == 0 into (unsigned)A <= bool and (A>>bool) != 0 -> (unsigned)A > bool. This transformation can improve performance by allowing the compiler to generate more efficient code for certain bit manipulation operations. The pattern is gated with #if GIMPLE and the result of the right shift is marked as ‘single_use’.