Commit 2fed2012 by Jakub Jelinek Committed by Jakub Jelinek

re PR debug/44901 (-fcompare-debug failure for tree-predcom.c)

	PR debug/44901
	* vec.h (VEC_block_remove): Fix comment.
	* tree-ssa-live.c (remove_unused_locals): Don't use
	VEC_unordered_remove on local_decls, instead replace a single
	vector element in each iteration if at least one element had
	to be removed and VEC_truncate at the end.
	* omp-low.c (expand_omp_taskreg): Likewise.

From-SVN: r162126
parent 88ce8031
2010-07-13 Jakub Jelinek <jakub@redhat.com>
PR debug/44901
* vec.h (VEC_block_remove): Fix comment.
* tree-ssa-live.c (remove_unused_locals): Don't use
VEC_unordered_remove on local_decls, instead replace a single
vector element in each iteration if at least one element had
to be removed and VEC_truncate at the end.
* omp-low.c (expand_omp_taskreg): Likewise.
2010-07-13 Manuel López-Ibáñez <manu@gcc.gnu.org> 2010-07-13 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c-decl.c (finish_function): Fix typo in comment. * c-decl.c (finish_function): Fix typo in comment.
......
...@@ -3378,7 +3378,7 @@ expand_omp_taskreg (struct omp_region *region) ...@@ -3378,7 +3378,7 @@ expand_omp_taskreg (struct omp_region *region)
} }
else else
{ {
unsigned ix; unsigned srcidx, dstidx, num;
/* If the parallel region needs data sent from the parent /* If the parallel region needs data sent from the parent
function, then the very first statement (except possible function, then the very first statement (except possible
...@@ -3515,11 +3515,18 @@ expand_omp_taskreg (struct omp_region *region) ...@@ -3515,11 +3515,18 @@ expand_omp_taskreg (struct omp_region *region)
single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; single_succ_edge (new_bb)->flags = EDGE_FALLTHRU;
/* Remove non-local VAR_DECLs from child_cfun->local_decls list. */ /* Remove non-local VAR_DECLs from child_cfun->local_decls list. */
for (ix = 0; VEC_iterate (tree, child_cfun->local_decls, ix, t); ) num = VEC_length (tree, child_cfun->local_decls);
if (DECL_CONTEXT (t) != cfun->decl) for (srcidx = 0, dstidx = 0; srcidx < num; srcidx++)
ix++; {
else t = VEC_index (tree, child_cfun->local_decls, srcidx);
VEC_unordered_remove (tree, child_cfun->local_decls, ix); if (DECL_CONTEXT (t) == cfun->decl)
continue;
if (srcidx != dstidx)
VEC_replace (tree, child_cfun->local_decls, dstidx, t);
dstidx++;
}
if (dstidx != num)
VEC_truncate (tree, child_cfun->local_decls, dstidx);
/* Inform the callgraph about the new function. */ /* Inform the callgraph about the new function. */
DECL_STRUCT_FUNCTION (child_fn)->curr_properties DECL_STRUCT_FUNCTION (child_fn)->curr_properties
......
...@@ -689,7 +689,7 @@ remove_unused_locals (void) ...@@ -689,7 +689,7 @@ remove_unused_locals (void)
referenced_var_iterator rvi; referenced_var_iterator rvi;
var_ann_t ann; var_ann_t ann;
bitmap global_unused_vars = NULL; bitmap global_unused_vars = NULL;
unsigned ix; unsigned srcidx, dstidx, num;
/* Removing declarations from lexical blocks when not optimizing is /* Removing declarations from lexical blocks when not optimizing is
not only a waste of time, it actually causes differences in stack not only a waste of time, it actually causes differences in stack
...@@ -756,8 +756,10 @@ remove_unused_locals (void) ...@@ -756,8 +756,10 @@ remove_unused_locals (void)
cfun->has_local_explicit_reg_vars = false; cfun->has_local_explicit_reg_vars = false;
/* Remove unmarked local vars from local_decls. */ /* Remove unmarked local vars from local_decls. */
for (ix = 0; VEC_iterate (tree, cfun->local_decls, ix, var); ) num = VEC_length (tree, cfun->local_decls);
for (srcidx = 0, dstidx = 0; srcidx < num; 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)) || !ann->used))
...@@ -769,18 +771,19 @@ remove_unused_locals (void) ...@@ -769,18 +771,19 @@ remove_unused_locals (void)
bitmap_set_bit (global_unused_vars, DECL_UID (var)); bitmap_set_bit (global_unused_vars, DECL_UID (var));
} }
else else
{
VEC_unordered_remove (tree, cfun->local_decls, ix);
continue; continue;
} }
}
else if (TREE_CODE (var) == VAR_DECL else if (TREE_CODE (var) == VAR_DECL
&& DECL_HARD_REGISTER (var) && DECL_HARD_REGISTER (var)
&& !is_global_var (var)) && !is_global_var (var))
cfun->has_local_explicit_reg_vars = true; cfun->has_local_explicit_reg_vars = true;
ix++; if (srcidx != dstidx)
VEC_replace (tree, cfun->local_decls, dstidx, var);
dstidx++;
} }
if (dstidx != num)
VEC_truncate (tree, cfun->local_decls, dstidx);
/* Remove unmarked global vars from local_decls. */ /* Remove unmarked global vars from local_decls. */
if (global_unused_vars != NULL) if (global_unused_vars != NULL)
...@@ -794,13 +797,21 @@ remove_unused_locals (void) ...@@ -794,13 +797,21 @@ remove_unused_locals (void)
&& ann->used) && ann->used)
mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars); mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars);
for (ix = 0; VEC_iterate (tree, cfun->local_decls, ix, var); ) num = VEC_length (tree, cfun->local_decls);
for (srcidx = 0, dstidx = 0; srcidx < num; srcidx++)
{
var = VEC_index (tree, cfun->local_decls, srcidx);
if (TREE_CODE (var) == VAR_DECL if (TREE_CODE (var) == VAR_DECL
&& is_global_var (var) && is_global_var (var)
&& bitmap_bit_p (global_unused_vars, DECL_UID (var))) && bitmap_bit_p (global_unused_vars, DECL_UID (var)))
VEC_unordered_remove (tree, cfun->local_decls, ix); continue;
else
ix++; if (srcidx != dstidx)
VEC_replace (tree, cfun->local_decls, dstidx, var);
dstidx++;
}
if (dstidx != num)
VEC_truncate (tree, cfun->local_decls, dstidx);
BITMAP_FREE (global_unused_vars); BITMAP_FREE (global_unused_vars);
} }
......
...@@ -424,7 +424,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -424,7 +424,7 @@ along with GCC; see the file COPYING3. If not see
void VEC_T_block_remove (VEC(T) *v, unsigned ix, unsigned len); void VEC_T_block_remove (VEC(T) *v, unsigned ix, unsigned len);
Remove LEN elements starting at the IXth. Ordering is retained. Remove LEN elements starting at the IXth. Ordering is retained.
This is an O(1) operation. */ This is an O(N) operation due to memmove. */
#define VEC_block_remove(T,V,I,L) \ #define VEC_block_remove(T,V,I,L) \
(VEC_OP(T,base,block_remove)(VEC_BASE(V),I,L VEC_CHECK_INFO)) (VEC_OP(T,base,block_remove)(VEC_BASE(V),I,L VEC_CHECK_INFO))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment