Landing: 3e2b0fcab755
Project / Subsystem
gcc / tree-optimization
Date
2026-07-18
Author
Torbjörn SVENSSON
Commit
3e2b0fcab75527bae01a0e22fe993addcf8475d9
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- tree-optimization
- patch_id
- —
- commit_hash
- 3e2b0fcab75527bae01a0e22fe993addcf8475d9
- source_type
- github
- headline
- Fold constant conditional selects for integral types.
- tldr
- Optimize conditional selects of the form (x == CST) ? x : CST to CST.
- author
- Torbjörn SVENSSON
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • tree-ssa
- • arm
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-18T00:00:00.000Z
This change allows the compiler to fold conditional select expressions where the condition compares a variable against a constant. Specifically, it handles cases like (x == CST) ? x : CST and (x != CST) ? CST : x, simplifying them to CST for integral scalar and vector types. This optimization catches patterns previously converted from bitwise masks, including some ARM MVE specific forms, leading to more efficient code.