diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2009-10-12 18:58:38 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2009-10-12 18:58:38 +0000 |
commit | 0ca5af51abe63d31a944080e63f04ff3525363e6 (patch) | |
tree | 0cd2fe4eab12298b796d2e872b3b8cd073d8ef6c /gcc/tree-ssa-loop-im.c | |
parent | 2e723874b5ed813da802a8dcb81134172d6408c6 (diff) | |
download | gcc-0ca5af51abe63d31a944080e63f04ff3525363e6.zip gcc-0ca5af51abe63d31a944080e63f04ff3525363e6.tar.gz gcc-0ca5af51abe63d31a944080e63f04ff3525363e6.tar.bz2 |
re PR debug/41343 (sysdeps/ieee754/dbl-64/dosincos.c from glibc causes excessive memory use)
gcc/ChangeLog:
PR debug/41343
PR debug/41447
PR debug/41264
PR debug/41338
* tree.def (DEBUG_EXPR_DECL): New.
* rtl.def (DEBUG_EXPR): New.
* gengtype.c (adjust_field_rtx_def): Handle it.
* tree-ssa.c (propagate_var_def_into_debug_stmts): Rename to...
(insert_debug_temp_for_var_def): ... this. Drop support for
moving. Take iterator for def stmt; insert debug stmt before it.
Scan early for use count and kind in debug stmts.
(propagate_defs_into_debug_stmts): Rename to...
(insert_debug_temps_for_defs): ... this. Likewise.
* tree.h (DEBUG_TEMP_UID): New.
* tree.c (next_debug_decl_uid): New.
(make_node_stat): Count debug decls separately.
(copy_node_stat): Likewise.
* cfgexpand.c (expand_debug_expr): Handle DEBUG_EXPR_DECL.
* var-tracking.c (dv_is_decl_p): Recognize it.
(VALUE_RECURSED_INTO): Apply to DEBUG_EXPRs too.
(track_expr_p): Track expanded DEBUG_EXPR_DECLs.
(vt_expand_loc_callback): Expand DEBUG_EXPRs.
(emit_note_insn_var_location): Don't emit notes for DEBUG_EXPR_DECLs.
* cselib.c (rtx_equal_for_cselib_p): Handle DEBUG_EXPR.
(cselib_hash_rtx): Likewise.
(cselib_expand_value_rtx_1): Use callback for DEBUG_EXPR.
* tree-ssa-operands.c (get_expr_operands): Skip DEBUG_EXPR_DECLs in
debug bind stmts.
* emit-rtl.c (verify_rtx_sharing): Handle DEBUG_EXPR and VALUE.
(copy_rtx_if_shared_1, reset_used_flags, set_used_flags): Likewise.
* rtl.c (copy_rtx): Likewise.
(rtx_equal_p_cb, rtx_equal_p): Handle DEBUG_EXPR.
* print-rtl.c (print_rtx): Likewise.
* sched-vis.c (print_value): Likewise.
(print_insn): Handle DEBUG_EXPR_DECL.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-pretty-print.c (dump_decl_name, dump_generic_node): Likewise.
* gimple-iterator (gsi_replace): Check for same lhs.
(gsi_remove): Insert debug temps.
* tree-ssa-loop-im.c (rewrite_reciprocal): Replace with same lhs.
(move_computations_stmt): Drop explicit propagation into debug stmts.
(rewrite_bittest): Likewise. Use gsi_remove for propagation.
* tree-ssa-reassoc.c (rewrite_expr_tree, linearize_expr): Likewise.
* tree-ssa-sink.c (statement_sink_location): Likewise.
* tree-ssa-forwprop (forward_propagate_addr_expr): Likewise.
* tree-ssanames.c (release_ssa_name): Adjust for rename.
* tree-flow.h: Likewise.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Don't mark
debug temps without values.
(eliminate_unnecessary_stmts): Don't discard just-inserted
debug stmts.
gcc/testsuite/ChangeLog:
PR debug/41343
PR debug/41447
PR debug/41264
PR debug/41338
* gcc.dg/guality/pr41447-1.c: New.
* gcc.dg/debug/pr41264-1.c: New.
* gcc.dg/debug/pr41343-1.c: New.
From-SVN: r152681
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 7382494..6c6a9f1 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -764,6 +764,7 @@ rewrite_reciprocal (gimple_stmt_iterator *bsi) gimple stmt, stmt1, stmt2; tree var, name, lhs, type; tree real_one; + gimple_stmt_iterator gsi; stmt = gsi_stmt (*bsi); lhs = gimple_assign_lhs (stmt); @@ -798,8 +799,9 @@ rewrite_reciprocal (gimple_stmt_iterator *bsi) /* Replace division stmt with reciprocal and multiply stmts. The multiply stmt is not invariant, so update iterator and avoid rescanning. */ - gsi_replace (bsi, stmt1, true); - gsi_insert_after (bsi, stmt2, GSI_NEW_STMT); + gsi = *bsi; + gsi_insert_before (bsi, stmt1, GSI_NEW_STMT); + gsi_replace (&gsi, stmt2, true); /* Continue processing with invariant reciprocal statement. */ return stmt1; @@ -858,6 +860,8 @@ rewrite_bittest (gimple_stmt_iterator *bsi) if (outermost_invariant_loop (b, loop_containing_stmt (stmt1)) != NULL && outermost_invariant_loop (a, loop_containing_stmt (stmt1)) == NULL) { + gimple_stmt_iterator rsi; + /* 1 << B */ var = create_tmp_var (TREE_TYPE (a), "shifttmp"); add_referenced_var (var); @@ -878,9 +882,14 @@ rewrite_bittest (gimple_stmt_iterator *bsi) SET_USE (use, name); gimple_cond_set_rhs (use_stmt, build_int_cst_type (TREE_TYPE (name), 0)); - gsi_insert_before (bsi, stmt1, GSI_SAME_STMT); - propagate_defs_into_debug_stmts (gsi_stmt (*bsi), NULL, NULL); - gsi_replace (bsi, stmt2, true); + /* Don't use gsi_replace here, none of the new assignments sets + the variable originally set in stmt. Move bsi to stmt1, and + then remove the original stmt, so that we get a chance to + retain debug info for it. */ + rsi = *bsi; + gsi_insert_before (bsi, stmt1, GSI_NEW_STMT); + gsi_insert_before (&rsi, stmt2, GSI_SAME_STMT); + gsi_remove (&rsi, true); return stmt1; } @@ -1060,7 +1069,6 @@ move_computations_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED, mark_virtual_ops_for_renaming (stmt); gsi_insert_on_edge (loop_preheader_edge (level), stmt); - propagate_defs_into_debug_stmts (gsi_stmt (bsi), NULL, NULL); gsi_remove (&bsi, false); } } |