From 9e73c69087510db9321f4f6d91280519a643ff55 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 13 Jan 2010 14:26:47 +0100 Subject: [PATCH] re PR debug/41371 (var-tracking is slow and memory hungry) PR debug/41371 * var-tracking.c (values_to_unmark): New variable. (find_loc_in_1pdv): Clear VALUE_RECURSED_INTO of values in values_to_unmark vector. Moved body to... (find_loc_in_1pdv_1): ... this. Don't clear VALUE_RECURSED_INTO, instead queue it into values_to_unmark vector. (vt_find_locations): Free values_to_unmark vector. From-SVN: r155858 --- gcc/ChangeLog | 10 ++++++++++ gcc/var-tracking.c | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b619561406b..5b291e65138 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2010-01-13 Jakub Jelinek + + PR debug/41371 + * var-tracking.c (values_to_unmark): New variable. + (find_loc_in_1pdv): Clear VALUE_RECURSED_INTO of values in + values_to_unmark vector. Moved body to... + (find_loc_in_1pdv_1): ... this. Don't clear VALUE_RECURSED_INTO, + instead queue it into values_to_unmark vector. + (vt_find_locations): Free values_to_unmark vector. + 2010-01-13 Wolfgang Gellerich * config/s390/s390.c (override_options): Set diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index db7778b8e74..0822fecab34 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -1,5 +1,5 @@ /* Variable tracking routines for the GNU compiler. - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009 + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -2252,12 +2252,18 @@ dv_changed_p (decl_or_value dv) : DECL_CHANGED (dv_as_decl (dv))); } -/* Return a location list node whose loc is rtx_equal to LOC, in the +/* Vector of VALUEs that should have VALUE_RECURSED_INTO bit cleared + at the end of find_loc_in_1pdv. Not a static variable in find_loc_in_1pdv + to avoid constant allocation/freeing of it. */ +static VEC(rtx, heap) *values_to_unmark; + +/* Helper function for find_loc_in_1pdv. + Return a location list node whose loc is rtx_equal to LOC, in the location list of a one-part variable or value VAR, or in that of any values recursively mentioned in the location lists. */ static location_chain -find_loc_in_1pdv (rtx loc, variable var, htab_t vars) +find_loc_in_1pdv_1 (rtx loc, variable var, htab_t vars) { location_chain node; @@ -2285,18 +2291,33 @@ find_loc_in_1pdv (rtx loc, variable var, htab_t vars) { location_chain where; VALUE_RECURSED_INTO (node->loc) = true; - if ((where = find_loc_in_1pdv (loc, var, vars))) - { - VALUE_RECURSED_INTO (node->loc) = false; - return where; - } - VALUE_RECURSED_INTO (node->loc) = false; + VEC_safe_push (rtx, heap, values_to_unmark, node->loc); + if ((where = find_loc_in_1pdv_1 (loc, var, vars))) + return where; } } return NULL; } +/* Return a location list node whose loc is rtx_equal to LOC, in the + location list of a one-part variable or value VAR, or in that of + any values recursively mentioned in the location lists. */ + +static location_chain +find_loc_in_1pdv (rtx loc, variable var, htab_t vars) +{ + location_chain ret; + unsigned int i; + rtx value; + + ret = find_loc_in_1pdv_1 (loc, var, vars); + for (i = 0; VEC_iterate (rtx, values_to_unmark, i, value); i++) + VALUE_RECURSED_INTO (value) = false; + VEC_truncate (rtx, values_to_unmark, 0); + return ret; +} + /* Hash table iteration argument passed to variable_merge. */ struct dfset_merge { @@ -5648,6 +5669,7 @@ vt_find_locations (void) FOR_EACH_BB (bb) gcc_assert (VTI (bb)->flooded); + VEC_free (rtx, heap, values_to_unmark); free (bb_order); fibheap_delete (worklist); fibheap_delete (pending); -- 2.30.2