diff options
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r-- | gcc/tree-ssa-dse.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 223682b..e0c3b74 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -218,7 +218,10 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi) if (is_gimple_call (stmt) && gimple_call_fndecl (stmt)) return; - if (gimple_has_volatile_ops (stmt)) + /* Don't return early on *this_2(D) ={v} {CLOBBER}. */ + if (gimple_has_volatile_ops (stmt) + && (!gimple_clobber_p (stmt) + || TREE_CODE (gimple_assign_lhs (stmt)) != MEM_REF)) return; if (is_gimple_assign (stmt)) @@ -228,6 +231,12 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi) if (!dse_possible_dead_store_p (stmt, &use_stmt)) return; + /* But only remove *this_2(D) ={v} {CLOBBER} if killed by + another clobber stmt. */ + if (gimple_clobber_p (stmt) + && !gimple_clobber_p (use_stmt)) + return; + /* If we have precisely one immediate use at this point and the stores are to the same memory location or there is a chain of virtual uses from stmt and the stmt which stores to that same |