Landing: cd33e5ad1945
Project / Subsystem
gcc / cselim
Date
2026-06-05
Author
Andrew Pinski
Commit
cd33e5ad1945f19b5b1b2429ee62d1b3c8919914
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- cselim
- patch_id
- —
- commit_hash
- cd33e5ad1945f19b5b1b2429ee62d1b3c8919914
- source_type
- github
- headline
- Cselim prevents store sinking with loads in middle basic block
- tldr
- Cselim optimization now avoids sinking stores across basic blocks if there are loads accessing the same memory in an intermediate block, preventing incorrect c…
- author
- Andrew Pinski
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • compiler-bug
- • memory-safety
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-06-05T00:00:00.000Z
A recent change to the Common Subexpression Elimination (CSElim) optimization allowed store sinking even when a middle basic block was non-empty and contained active loads. This could incorrectly mark a symbol as non-trapping, leading to wrong code if an intermediate load accessed the stored value before the store was sunk. The cond_store_replacement function in tree-ssa-phiopt.cc now explicitly checks for loads within the middle basic block, disabling store sinking in such cases to ensure correctness.