summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-16 22:05:32 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-16 22:05:32 +0000
commit3d3c2244f905bd4ce76f94208cfff729156ec336 (patch)
tree2db16daaa7fb930d896da0a77681b31da463c821 /gcc/tree-ssa-dom.c
parentc5981d0c3af4fa743c01fa2470f985ae53eb3238 (diff)
downloadgcc-3d3c2244f905bd4ce76f94208cfff729156ec336.tar.gz
PR tree-optimization/55329
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Never clear bits in needed_eh_cleanup while iterating over the bitmap. Look through all forwarder blocks at once. * g++.dg/opt/pr55329.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193577 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 7322b58aad1..7d015b7837c 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1,6 +1,6 @@
/* SSA Dominator optimizations for trees
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011, 2012 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@@ -801,17 +801,21 @@ tree_ssa_dominator_optimize (void)
/* Jump threading may have created forwarder blocks from blocks
needing EH cleanup; the new successor of these blocks, which
- has inherited from the original block, needs the cleanup. */
+ has inherited from the original block, needs the cleanup.
+ Don't clear bits in the bitmap, as that can break the bitmap
+ iterator. */
EXECUTE_IF_SET_IN_BITMAP (need_eh_cleanup, 0, i, bi)
{
basic_block bb = BASIC_BLOCK (i);
- if (bb
- && single_succ_p (bb)
- && (single_succ_edge (bb)->flags & EDGE_EH) == 0)
- {
- bitmap_clear_bit (need_eh_cleanup, i);
- bitmap_set_bit (need_eh_cleanup, single_succ (bb)->index);
- }
+ if (bb == NULL)
+ continue;
+ while (single_succ_p (bb)
+ && (single_succ_edge (bb)->flags & EDGE_EH) == 0)
+ bb = single_succ (bb);
+ if (bb == EXIT_BLOCK_PTR)
+ continue;
+ if ((unsigned) bb->index != i)
+ bitmap_set_bit (need_eh_cleanup, bb->index);
}
gimple_purge_all_dead_eh_edges (need_eh_cleanup);