Landing: 542d7eaf7670
Project / Subsystem
gcc / simplify-rtx
Date
2026-08-13
Author
Rohith Kapelli
Commit
542d7eaf767057fbd224d44dbc1772dea3e41891
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- simplify-rtx
- patch_id
- —
- commit_hash
- 542d7eaf767057fbd224d44dbc1772dea3e41891
- source_type
- github
- headline
- simplify-rtx: Widen memory attributes in "c ? a : a" fold
- tldr
- Fixes a bug where folding conditional expressions incorrectly narrowed memory alias information, potentially leading to dead code elimination.
- author
- Rohith Kapelli
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • bugfix
- • compiler-internals
- • gcc
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-13T00:00:00.000Z
A bug in GCC’s simplify-rtx pass allowed the folding of ternary operations like ‘c ? a : a’ to incorrectly narrow memory attributes. This happened because rtx_equal_p ignored memory attributes, leading to a single MEM reference being used even when the two conditional arms had incompatible alias sets. This could result in subsequent passes incorrectly removing seemingly dead store operations, leading to stale return values. The fix ensures the folded expression inherits only the memory attributes guaranteed by both operands, merging alias sets and other attributes appropriately.