diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-07-13 08:59:56 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-07-13 08:59:56 +0200 |
commit | 2fed2012d551c7215e9a5a355d3b9bfe5a4c8545 (patch) | |
tree | b123c5327b8752f626c90a170c875178af34b826 /gcc/tree-ssa-live.c | |
parent | 88ce80316fbb4d001f08eb4c65dbb7ae88e0474f (diff) | |
download | gcc-2fed2012d551c7215e9a5a355d3b9bfe5a4c8545.zip gcc-2fed2012d551c7215e9a5a355d3b9bfe5a4c8545.tar.gz gcc-2fed2012d551c7215e9a5a355d3b9bfe5a4c8545.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r-- | gcc/tree-ssa-live.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 883cca8..ab79d7f 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -689,7 +689,7 @@ remove_unused_locals (void) referenced_var_iterator rvi; var_ann_t ann; bitmap global_unused_vars = NULL; - unsigned ix; + unsigned srcidx, dstidx, num; /* Removing declarations from lexical blocks when not optimizing is not only a waste of time, it actually causes differences in stack @@ -756,8 +756,10 @@ remove_unused_locals (void) cfun->has_local_explicit_reg_vars = false; /* 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 && (!(ann = var_ann (var)) || !ann->used)) @@ -769,18 +771,19 @@ remove_unused_locals (void) bitmap_set_bit (global_unused_vars, DECL_UID (var)); } else - { - VEC_unordered_remove (tree, cfun->local_decls, ix); - continue; - } + continue; } else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var) && !is_global_var (var)) 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. */ if (global_unused_vars != NULL) @@ -794,13 +797,21 @@ remove_unused_locals (void) && ann->used) mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars); - for (ix = 0; VEC_iterate (tree, cfun->local_decls, ix, var); ) - if (TREE_CODE (var) == VAR_DECL - && is_global_var (var) - && bitmap_bit_p (global_unused_vars, DECL_UID (var))) - VEC_unordered_remove (tree, cfun->local_decls, ix); - else - ix++; + 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 + && is_global_var (var) + && bitmap_bit_p (global_unused_vars, DECL_UID (var))) + continue; + + 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); } |