From 0ca5af51abe63d31a944080e63f04ff3525363e6 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Mon, 12 Oct 2009 18:58:38 +0000 Subject: 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 --- gcc/var-tracking.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'gcc/var-tracking.c') diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index bdd3bde..840128c 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -732,6 +732,7 @@ dv_is_decl_p (decl_or_value dv) case (int)PARM_DECL: case (int)RESULT_DECL: case (int)FUNCTION_DECL: + case (int)DEBUG_EXPR_DECL: case (int)COMPONENT_REF: return true; @@ -2222,7 +2223,7 @@ dataflow_set_union (dataflow_set *dst, dataflow_set *src) /* Whether the value is currently being expanded. */ #define VALUE_RECURSED_INTO(x) \ - (RTL_FLAG_CHECK1 ("VALUE_RECURSED_INTO", (x), VALUE)->used) + (RTL_FLAG_CHECK2 ("VALUE_RECURSED_INTO", (x), VALUE, DEBUG_EXPR)->used) /* Whether the value is in changed_variables hash table. */ #define VALUE_CHANGED(x) \ (RTL_FLAG_CHECK1 ("VALUE_CHANGED", (x), VALUE)->frame_related) @@ -4112,6 +4113,9 @@ track_expr_p (tree expr, bool need_rtl) rtx decl_rtl; tree realdecl; + if (TREE_CODE (expr) == DEBUG_EXPR_DECL) + return DECL_RTL_SET_P (expr); + /* If EXPR is not a parameter or a variable do not track it. */ if (TREE_CODE (expr) != VAR_DECL && TREE_CODE (expr) != PARM_DECL) return 0; @@ -6271,11 +6275,12 @@ vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data) decl_or_value dv; variable var; location_chain loc; - rtx result; + rtx result, subreg, xret; - if (GET_CODE (x) == SUBREG) + switch (GET_CODE (x)) { - rtx subreg = SUBREG_REG (x); + case SUBREG: + subreg = SUBREG_REG (x); if (GET_CODE (SUBREG_REG (x)) != VALUE) return x; @@ -6297,22 +6302,31 @@ vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data) result = gen_rtx_raw_SUBREG (GET_MODE (x), subreg, SUBREG_BYTE (x)); return result; - } - if (GET_CODE (x) != VALUE) - return x; + case DEBUG_EXPR: + dv = dv_from_decl (XTREE (x, 0)); + xret = NULL; + break; + + case VALUE: + dv = dv_from_value (x); + xret = x; + break; + + default: + return x; + } if (VALUE_RECURSED_INTO (x)) - return x; + return NULL; - dv = dv_from_value (x); var = (variable) htab_find_with_hash (vars, dv, dv_htab_hash (dv)); if (!var) - return x; + return xret; if (var->n_var_parts == 0) - return x; + return xret; gcc_assert (var->n_var_parts == 1); @@ -6332,7 +6346,7 @@ vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data) if (result) return result; else - return x; + return xret; } /* Expand VALUEs in LOC, using VARS as well as cselib's equivalence @@ -6382,6 +6396,9 @@ emit_note_insn_var_location (void **varp, void *data) decl = dv_as_decl (var->dv); + if (TREE_CODE (decl) == DEBUG_EXPR_DECL) + goto clear; + gcc_assert (decl); complete = true; -- cgit v1.1