http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51106
--- Comment #16 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-03-27
13:28:03 UTC ---
So, something like the below patch, or even better -- as we want to fold all
RTL-build related pseudo passes into expand, make pass_instantiate_virtual_regs
also the expand part (thus, until the into_cfglayout pass), and then the new
cleanup_cfg will nicely work at the end of expand.
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index b86cc74..0c27d11 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2261,7 +2261,7 @@ purge_dead_edges (basic_block bb)
edge e;
rtx insn = BB_END (bb), note;
bool purged = false;
- bool found;
+ bool found, fallthru;
edge_iterator ei;
if (DEBUG_INSN_P (insn) && insn != BB_HEAD (bb))
@@ -2433,16 +2433,22 @@ purge_dead_edges (basic_block bb)
as these are only created by conditional branches. If we find such an
edge we know that there used to be a jump here and can then safely
remove all non-fallthru edges. */
- found = false;
+ found = fallthru = false;
FOR_EACH_EDGE (e, ei, bb->succs)
- if (! (e->flags & (EDGE_COMPLEX | EDGE_FALLTHRU)))
- {
+ {
+ if (! (e->flags & (EDGE_COMPLEX | EDGE_FALLTHRU)))
found = true;
- break;
- }
-
+ if (e->flags & (EDGE_FALLTHRU | EDGE_FAKE))
+ fallthru = true;
+ }
if (!found)
return purged;
+ if (!fallthru)
+ {
+ gcc_assert (single_succ_p (bb));
+ single_succ_edge (bb)->flags |= EDGE_FALLTHRU;
+ return purged;
+ }
/* Remove all but the fake and fallthru edges. The fake edge may be
the only successor for this block in the case of noreturn