Landing: d5059b35e03e
Project / Subsystem
gcc / tree-optimization
Date
2026-07-15
Author
Jakub Jelinek
Commit
d5059b35e03e63c7686288c3554c2922a2c37468
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- tree-optimization
- patch_id
- —
- commit_hash
- d5059b35e03e63c7686288c3554c2922a2c37468
- source_type
- github
- headline
- match.pd: Guard x+x -> x*2 simplification
- tldr
- The x+x -> x*2 simplification is now guarded to ensure '2' is representable in the type.
- author
- Jakub Jelinek
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • integer types
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-15T00:00:00.000Z
A simplification that transforms x + x into x * 2 is now guarded to prevent incorrect transformations on types where the literal 2 cannot be represented. This addresses a bug where certain small fixed-width integer types could lead to multiplication by zero or -2 instead of the intended value. A new test case verifies this behavior.