mirror of git://gcc.gnu.org/git/gcc.git
re PR debug/47106 (-fcompare-debug failure (length) with -fpartial-inlining -flto -fconserve-stack)
PR debug/47106 PR debug/47402 * tree-flow-inline.h (clear_is_used, is_used_p): New. * cfgexpand.c (account_used_vars_for_block): Use them. * tree-nrv.c (tree_nrv): Likewise. * tree-ssa-live.c (remove_unused_scope_block_p): Likewise. (dump_scope_block): Likewise. (remove_unused_locals): Likewise. From-SVN: r169515
This commit is contained in:
parent
aaa2ac931e
commit
83d707929b
|
@ -1,3 +1,14 @@
|
||||||
|
2011-02-02 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
PR debug/47106
|
||||||
|
PR debug/47402
|
||||||
|
* tree-flow-inline.h (clear_is_used, is_used_p): New.
|
||||||
|
* cfgexpand.c (account_used_vars_for_block): Use them.
|
||||||
|
* tree-nrv.c (tree_nrv): Likewise.
|
||||||
|
* tree-ssa-live.c (remove_unused_scope_block_p): Likewise.
|
||||||
|
(dump_scope_block): Likewise.
|
||||||
|
(remove_unused_locals): Likewise.
|
||||||
|
|
||||||
2011-02-02 Alexandre Oliva <aoliva@redhat.com>
|
2011-02-02 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
PR debug/47106
|
PR debug/47106
|
||||||
|
|
|
@ -1325,7 +1325,7 @@ account_used_vars_for_block (tree block, bool toplevel)
|
||||||
|
|
||||||
/* Expand all variables at this level. */
|
/* Expand all variables at this level. */
|
||||||
for (t = BLOCK_VARS (block); t ; t = DECL_CHAIN (t))
|
for (t = BLOCK_VARS (block); t ; t = DECL_CHAIN (t))
|
||||||
if (var_ann (t) && var_ann (t)->used)
|
if (var_ann (t) && is_used_p (t))
|
||||||
size += expand_one_var (t, toplevel, false);
|
size += expand_one_var (t, toplevel, false);
|
||||||
|
|
||||||
/* Expand all variables at containing levels. */
|
/* Expand all variables at containing levels. */
|
||||||
|
|
|
@ -569,9 +569,26 @@ static inline void
|
||||||
set_is_used (tree var)
|
set_is_used (tree var)
|
||||||
{
|
{
|
||||||
var_ann_t ann = get_var_ann (var);
|
var_ann_t ann = get_var_ann (var);
|
||||||
ann->used = 1;
|
ann->used = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear VAR's used flag. */
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
clear_is_used (tree var)
|
||||||
|
{
|
||||||
|
var_ann_t ann = var_ann (var);
|
||||||
|
ann->used = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return true if VAR is marked as used. */
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
is_used_p (tree var)
|
||||||
|
{
|
||||||
|
var_ann_t ann = var_ann (var);
|
||||||
|
return ann->used;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return true if T (assumed to be a DECL) is a global variable.
|
/* Return true if T (assumed to be a DECL) is a global variable.
|
||||||
A variable is considered global if its storage is not automatic. */
|
A variable is considered global if its storage is not automatic. */
|
||||||
|
|
|
@ -263,7 +263,7 @@ tree_nrv (void)
|
||||||
DECL_HAS_VALUE_EXPR_P (found) = 1;
|
DECL_HAS_VALUE_EXPR_P (found) = 1;
|
||||||
|
|
||||||
/* FOUND is no longer used. Ensure it gets removed. */
|
/* FOUND is no longer used. Ensure it gets removed. */
|
||||||
var_ann (found)->used = 0;
|
clear_is_used (found);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -468,7 +468,7 @@ remove_unused_scope_block_p (tree scope)
|
||||||
Exception are the scope blocks not containing any instructions
|
Exception are the scope blocks not containing any instructions
|
||||||
at all so user can't get into the scopes at first place. */
|
at all so user can't get into the scopes at first place. */
|
||||||
else if ((ann = var_ann (*t)) != NULL
|
else if ((ann = var_ann (*t)) != NULL
|
||||||
&& ann->used)
|
&& is_used_p (*t))
|
||||||
unused = false;
|
unused = false;
|
||||||
else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
|
else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
|
||||||
/* For labels that are still used in the IL, the decision to
|
/* For labels that are still used in the IL, the decision to
|
||||||
|
@ -633,13 +633,11 @@ dump_scope_block (FILE *file, int indent, tree scope, int flags)
|
||||||
for (var = BLOCK_VARS (scope); var; var = DECL_CHAIN (var))
|
for (var = BLOCK_VARS (scope); var; var = DECL_CHAIN (var))
|
||||||
{
|
{
|
||||||
bool used = false;
|
bool used = false;
|
||||||
var_ann_t ann;
|
|
||||||
|
|
||||||
if ((ann = var_ann (var))
|
if (var_ann (var))
|
||||||
&& ann->used)
|
used = is_used_p (var);
|
||||||
used = true;
|
|
||||||
|
|
||||||
fprintf (file, "%*s",indent, "");
|
fprintf (file, "%*s", indent, "");
|
||||||
print_generic_decl (file, var, flags);
|
print_generic_decl (file, var, flags);
|
||||||
fprintf (file, "%s\n", used ? "" : " (unused)");
|
fprintf (file, "%s\n", used ? "" : " (unused)");
|
||||||
}
|
}
|
||||||
|
@ -708,7 +706,7 @@ remove_unused_locals (void)
|
||||||
|
|
||||||
/* Assume all locals are unused. */
|
/* Assume all locals are unused. */
|
||||||
FOR_EACH_REFERENCED_VAR (t, rvi)
|
FOR_EACH_REFERENCED_VAR (t, rvi)
|
||||||
var_ann (t)->used = false;
|
clear_is_used (t);
|
||||||
|
|
||||||
/* Walk the CFG marking all referenced symbols. */
|
/* Walk the CFG marking all referenced symbols. */
|
||||||
FOR_EACH_BB (bb)
|
FOR_EACH_BB (bb)
|
||||||
|
@ -769,7 +767,7 @@ remove_unused_locals (void)
|
||||||
var = VEC_index (tree, cfun->local_decls, srcidx);
|
var = VEC_index (tree, cfun->local_decls, srcidx);
|
||||||
if (TREE_CODE (var) != FUNCTION_DECL
|
if (TREE_CODE (var) != FUNCTION_DECL
|
||||||
&& (!(ann = var_ann (var))
|
&& (!(ann = var_ann (var))
|
||||||
|| !ann->used))
|
|| !is_used_p (var)))
|
||||||
{
|
{
|
||||||
if (is_global_var (var))
|
if (is_global_var (var))
|
||||||
{
|
{
|
||||||
|
@ -801,7 +799,7 @@ remove_unused_locals (void)
|
||||||
if (TREE_CODE (var) == VAR_DECL
|
if (TREE_CODE (var) == VAR_DECL
|
||||||
&& is_global_var (var)
|
&& is_global_var (var)
|
||||||
&& (ann = var_ann (var)) != NULL
|
&& (ann = var_ann (var)) != NULL
|
||||||
&& ann->used)
|
&& is_used_p (var))
|
||||||
mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars);
|
mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars);
|
||||||
|
|
||||||
num = VEC_length (tree, cfun->local_decls);
|
num = VEC_length (tree, cfun->local_decls);
|
||||||
|
@ -827,8 +825,8 @@ remove_unused_locals (void)
|
||||||
if (!is_global_var (t)
|
if (!is_global_var (t)
|
||||||
&& TREE_CODE (t) != PARM_DECL
|
&& TREE_CODE (t) != PARM_DECL
|
||||||
&& TREE_CODE (t) != RESULT_DECL
|
&& TREE_CODE (t) != RESULT_DECL
|
||||||
&& !(ann = var_ann (t))->used
|
&& !is_used_p (t)
|
||||||
&& !ann->is_heapvar)
|
&& !var_ann (t)->is_heapvar)
|
||||||
remove_referenced_var (t);
|
remove_referenced_var (t);
|
||||||
remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
|
remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
|
||||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||||
|
|
Loading…
Reference in New Issue