GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
cselim Performance Win

cselim: Reduced conditional store elimination without non-trapping

New reduced conditional store elimination function enables optimizations in phiopt and handles cases without prior loads/stores.

A new, reduced functionality for conditional store elimination (cond_store_replacement_limited) has been introduced. This function, designed for use by the phiopt pass, can operate even without the full non-trapping code analysis. It supports optimizing cases where a store occurs before a conditional, or where a non-trapping load precedes the conditional, and also handles edge cases with non-trapping memory access.

In Details

This commit introduces cond_store_replacement_limited into tree-ssa-phiopt.cc and related helper functions in tree-eh.cc. This function performs conditional store elimination by looking for a similar store before the conditional, or a non-trapping load preceding it. Crucially, it enables optimization even for memory accesses that might trap, as long as they aren't on the critical path that phiopt simplifies. The 'limited' aspect refers to its ability to function without requiring store sinking or full non-trapping code analysis, making it suitable for earlier optimization passes.

For Context
cselim
Conditional Store Elimination, an optimization pass in GCC that aims to remove redundant conditional stores from the code.
non-trapping
Refers to memory operations (loads or stores) that are guaranteed not to cause an exception or program termination, such as accessing valid memory locations without data races or out-of-bounds access.
phiopt
A GCC optimization pass that optimizes PHI nodes, crucial for handling control flow merging in SSA form.
store sinking
An optimization that moves stores to later points in the code, often outside loops, to reduce their execution frequency.
SSA form
Static Single Assignment form, an intermediate representation in compilers where every variable is assigned a value exactly once.
Filed Under: optimizationcompiler passSSAmemory access