summaryrefslogtreecommitdiffstats
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authordaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-25 20:25:18 +0000
committerdaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-25 20:25:18 +0000
commitc4d13c5c0535f2eba2ab5b5dee94666ff6dc7e60 (patch)
tree697b3a3928c509ec1d15830956e5fd590de886f9 /gcc/cfgcleanup.c
parent616b875f3e877e13c8ed17204b2c208bd6769e31 (diff)
downloadppe42-gcc-c4d13c5c0535f2eba2ab5b5dee94666ff6dc7e60.tar.gz
ppe42-gcc-c4d13c5c0535f2eba2ab5b5dee94666ff6dc7e60.zip
2009-07-25 David Daney <ddaney@caviumnetworks.com>
PR rtl-optimization/40445 * emit-rtl.c (next_nonnote_insn_bb): New function. * rtl.h (next_nonnote_insn_bb): Declare new function. * cfgcleanup.c (try_optimize_cfg): Don't remove an empty block with no successors that is the successor of the ENTRY_BLOCK. Continue from the top after removing an empty fallthrough block. * cfgrtl.c (get_last_bb_insn): Call next_nonnote_insn_bb instead of next_nonnote_insn. 2009-07-25 David Daney <ddaney@caviumnetworks.com> PR rtl-optimization/40445 * g++.dg/other/builtin-unreachable-1.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150090 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 01ddf999ed3..c631907799e 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1846,10 +1846,16 @@ try_optimize_cfg (int mode)
/* Delete trivially dead basic blocks. This is either
blocks with no predecessors, or empty blocks with no
- successors. Empty blocks may result from expanding
+ successors. However if the empty block with no
+ successors is the successor of the ENTRY_BLOCK, it is
+ kept. This ensures that the ENTRY_BLOCK will have a
+ successor which is a precondition for many RTL
+ passes. Empty blocks may result from expanding
__builtin_unreachable (). */
if (EDGE_COUNT (b->preds) == 0
- || (EDGE_COUNT (b->succs) == 0 && BB_HEAD (b) == BB_END (b)))
+ || (EDGE_COUNT (b->succs) == 0
+ && BB_HEAD (b) == BB_END (b)
+ && single_succ_edge (ENTRY_BLOCK_PTR)->dest != b))
{
c = b->prev_bb;
if (dump_file)
@@ -1921,6 +1927,7 @@ try_optimize_cfg (int mode)
delete_basic_block (b);
changed = true;
b = c;
+ continue;
}
if (single_succ_p (b)
OpenPOWER on IntegriCloud