From 83bd032b4b837724b81c7db25be205771311a3a3 Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Sun, 4 Feb 2007 23:51:28 +0000 Subject: [PATCH] cfgcleanup.c (try_optimize_cfg): Avoid removing ENTRY_BLOCK_PTR. * cfgcleanup.c (try_optimize_cfg): Avoid removing ENTRY_BLOCK_PTR. From-SVN: r121584 --- gcc/ChangeLog | 6 +++++- gcc/cfgcleanup.c | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acb109e29ed..f458ac7b176 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2007-02-04 Zdenek Dvorak + + * cfgcleanup.c (try_optimize_cfg): Avoid removing ENTRY_BLOCK_PTR. + 2007-02-04 Zdenek Dvorak * cfgloopmanip.c (loop_delete_branch_edge): Removed. @@ -43,7 +47,7 @@ * passes.c (init_optimization_passes): Reindent. 2007-02-04 Jan Hubicka - Eric Botcazou + Eric Botcazou * tree-optimize.c (has_abnormal_outgoing_edge_p): Move to... (execute_fixup_cfg): Break out the abnormal goto code. diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 7c5b745a650..ee5c69bd2e6 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1992,7 +1992,7 @@ try_optimize_cfg (int mode) bool changed_here = false; /* Delete trivially dead basic blocks. */ - while (EDGE_COUNT (b->preds) == 0) + if (EDGE_COUNT (b->preds) == 0) { c = b->prev_bb; if (dump_file) @@ -2002,7 +2002,9 @@ try_optimize_cfg (int mode) delete_basic_block (b); if (!(mode & CLEANUP_CFGLAYOUT)) changed = true; - b = c; + /* Avoid trying to remove ENTRY_BLOCK_PTR. */ + b = (c == ENTRY_BLOCK_PTR ? c->next_bb : c); + continue; } /* Remove code labels no longer used. */