summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dce.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2011-11-08 16:47:16 +0000
committerMichael Matz <matz@gcc.gnu.org>2011-11-08 16:47:16 +0000
commit47598145be96f39a73809240153e5af12bfbcedd (patch)
tree4dc2b97edd33ddeabf08fbbf07022528b2b4431c /gcc/tree-ssa-dce.c
parenta58a38b32c7ed8b4843e8d2b2658323204fa96ed (diff)
downloadgcc-47598145be96f39a73809240153e5af12bfbcedd.tar.gz
gengtype.c (write_field_root): Avoid out-of-scope access of newv.
* gengtype.c (write_field_root): Avoid out-of-scope access of newv. * tree-stdarg.c (execute_optimize_stdarg): Accept clobbers. * tree.h (TREE_CLOBBER_P): New macro. * gimple.h (gimple_clobber_p): New inline function. * gimplify.c (gimplify_bind_expr): Add clobbers for all variables that go out of scope and live in memory. * tree-ssa-operands.c (get_expr_operands): Transfer volatility also for constructors. * cfgexpand.c (decl_to_stack_part): New static variable. (add_stack_var): Allocate it, and remember mapping. (fini_vars_expansion): Deallocate it. (stack_var_conflict_p): Add early outs. (visit_op, visit_conflict, add_scope_conflicts_1, add_scope_conflicts): New static functions. (expand_used_vars_for_block): Don't call add_stack_var_conflict, tidy. (expand_used_vars): Add scope conflicts. (expand_gimple_stmt_1): Expand clobbers to nothing. (expand_debug_expr): Ditto. * tree-pretty-print.c (dump_generic_node): Dump clobbers nicely. * tree-ssa-live.c (remove_unused_locals): Remove clobbers that refer to otherwise unused locals. * tree-sra.c (build_accesses_from_assign): Ignore clobbers. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Clobbers of SSA names aren't necessary. (propagate_necessity): Accept and ignore constructors on the rhs, tidy. * gimple.c (walk_gimple_op): Accept constructors like mem_rhs. * tree-ssa-structalias.c (find_func_aliases): Clobbers don't store any known value. * tree-ssa-sccvn.c (vn_reference_lookup_3): Ditto, in particular they don't zero-initialize something. * tree-ssa-phiopt.c (cond_if_else_store_replacement_1): Ignore clobber RHS, we don't want PHI nodes with those. testsuite/ * gcc.dg/tree-ssa/20031015-1.c: Adjust. * g++.dg/tree-ssa/ehcleanup-1.C: Ditto. * g++.dg/eh/builtin1.C: Rewrite to not use local variables. * g++.dg/eh/builtin2.C: Ditto. * g++.dg/eh/builtin3.C: Ditto. From-SVN: r181172
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r--gcc/tree-ssa-dce.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 5a6a38e63e9..d6fbe622df0 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -351,6 +351,12 @@ mark_stmt_if_obviously_necessary (gimple stmt, bool aggressive)
mark_stmt_necessary (stmt, true);
break;
+ case GIMPLE_ASSIGN:
+ if (TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME
+ && TREE_CLOBBER_P (gimple_assign_rhs1 (stmt)))
+ return;
+ break;
+
default:
break;
}
@@ -917,19 +923,17 @@ propagate_necessity (struct edge_list *el)
else if (gimple_assign_single_p (stmt))
{
tree rhs;
- bool rhs_aliased = false;
/* If this is a load mark things necessary. */
rhs = gimple_assign_rhs1 (stmt);
if (TREE_CODE (rhs) != SSA_NAME
- && !is_gimple_min_invariant (rhs))
+ && !is_gimple_min_invariant (rhs)
+ && TREE_CODE (rhs) != CONSTRUCTOR)
{
if (!ref_may_be_aliased (rhs))
mark_aliased_reaching_defs_necessary (stmt, rhs);
else
- rhs_aliased = true;
+ mark_all_reaching_defs_necessary (stmt);
}
- if (rhs_aliased)
- mark_all_reaching_defs_necessary (stmt);
}
else if (gimple_code (stmt) == GIMPLE_RETURN)
{
@@ -937,7 +941,8 @@ propagate_necessity (struct edge_list *el)
/* A return statement may perform a load. */
if (rhs
&& TREE_CODE (rhs) != SSA_NAME
- && !is_gimple_min_invariant (rhs))
+ && !is_gimple_min_invariant (rhs)
+ && TREE_CODE (rhs) != CONSTRUCTOR)
{
if (!ref_may_be_aliased (rhs))
mark_aliased_reaching_defs_necessary (stmt, rhs);
@@ -955,6 +960,7 @@ propagate_necessity (struct edge_list *el)
tree op = TREE_VALUE (gimple_asm_input_op (stmt, i));
if (TREE_CODE (op) != SSA_NAME
&& !is_gimple_min_invariant (op)
+ && TREE_CODE (op) != CONSTRUCTOR
&& !ref_may_be_aliased (op))
mark_aliased_reaching_defs_necessary (stmt, op);
}