diff options
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-live.c | 21 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09f71c9..f943597 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,13 @@ 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 * gimple.c (gimple_fixup_complete_and_incomplete_subtype_p): New diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index d1f9e85..883cca8 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -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 |