Zdenek Dvorak - [patch] Avoid removing ENTRY_BLOCK_PTR in cfg cleanup (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Hello,

in case ENTRY_BLOCK_PTR->next_bb has no predecessor, cfgcleanup will end up trying to remove ENTRY_BLOCK_PTR (and ICEing). I do not have a testcase for this without some additional patches, but there is no guarantee that this cannot happen.

Bootstrapped & regtested on i686.

Zdenek

* cfgcleanup.c (try_optimize_cfg): Avoid removing ENTRY_BLOCK_PTR.

Index: cfgcleanup.c

*** cfgcleanup.c (revision 121474) --- cfgcleanup.c (working copy) *************** try_optimize_cfg (int mode) *** 1992,1998 **** bool changed_here = false;

        /* Delete trivially dead basic blocks.  */

! while (EDGE_COUNT (b->preds) == 0) { c = b->prev_bb; if (dump_file) --- 1992,1998 ---- bool changed_here = false;

        /* Delete trivially dead basic blocks.  */

! if (EDGE_COUNT (b->preds) == 0) { c = b->prev_bb; if (dump_file) *************** try_optimize_cfg (int mode) *** 2002,2008 **** delete_basic_block (b); if (!(mode & CLEANUP_CFGLAYOUT)) changed = true; ! b = c; }

        /* Remove code labels no longer used.  */

--- 2002,2010 ---- delete_basic_block (b); if (!(mode & CLEANUP_CFGLAYOUT)) changed = true; ! /* Avoid trying to remove ENTRY_BLOCK_PTR. */ ! b = (c == ENTRY_BLOCK_PTR ? c->next_bb : c); ! continue; }

        /* Remove code labels no longer used.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]