re PR debug/44832 (-fcompare-debug failure for C++ i386.c)

2010-07-10  Richard Guenther  <rguenther@suse.de>
	    Joern Rennecke  <joern.rennecke@embecosm.com>

	PR debug/44832
	* tree-ssa-live.c (mark_all_vars_used_1): Set TREE_USED for
	LABEL_DECL.
	(remove_unused_scope_block_p): Don't drop TREE_USED LABEL_DECLs
	unless they have DECL_IGNORED_P set.

Co-Authored-By: Joern Rennecke <joern.rennecke@embecosm.com>

From-SVN: r162035
This commit is contained in:
Richard Guenther 2010-07-10 09:40:36 +00:00 committed by Joern Rennecke
parent bcee752ee5
commit ccf134c74c
2 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2010-07-10 Richard Guenther <rguenther@suse.de>
Joern Rennecke <joern.rennecke@embecosm.com>
PR debug/44832
* tree-ssa-live.c (mark_all_vars_used_1): Set TREE_USED for
LABEL_DECL.
(remove_unused_scope_block_p): Don't drop TREE_USED LABEL_DECLs
unless they have DECL_IGNORED_P set.
2010-07-10 Richard Guenther <rguenther@suse.de>
PR lto/44889

View File

@ -383,6 +383,14 @@ mark_all_vars_used_1 (tree *tp, int *walk_subtrees, void *data)
}
set_is_used (t);
}
/* remove_unused_scope_block_p requires information about labels
which are not DECL_IGNORED_P to tell if they might be used in the IL. */
if (TREE_CODE (t) == LABEL_DECL)
/* Although the TREE_USED values that the frontend uses would be
acceptable (albeit slightly over-conservative) for our purposes,
init_vars_expansion clears TREE_USED for LABEL_DECLs too, so we
must re-compute it here. */
TREE_USED (t) = 1;
if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
@ -462,6 +470,19 @@ remove_unused_scope_block_p (tree scope)
else if ((ann = var_ann (*t)) != NULL
&& ann->used)
unused = false;
else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
/* For labels that are still used in the IL, the decision to
preserve them must not depend DEBUG_INFO_LEVEL, otherwise we
risk having different ordering in debug vs. non-debug builds
during inlining or versioning.
A label appearing here (we have already checked DECL_IGNORED_P)
should not be used in the IL unless it has been explicitly used
before, so we use TREE_USED as an approximation. */
/* In principle, we should do the same here as for the debug case
below, however, when debugging, there might be additional nested
levels that keep an upper level with a label live, so we have to
force this block to be considered used, too. */
unused = false;
/* When we are not doing full debug info, we however can keep around
only the used variables for cfgexpand's memory packing saving quite