From: Richard Guenther Date: Mon, 29 Oct 2012 14:25:22 +0000 (+0000) Subject: re PR middle-end/53695 (ICE: in dfs_enumerate_from, at cfganal.c:1221 with -O2 -ftrac... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9dcbb3806d28c26b27137f6d3b8538a011b8960e;p=gcc.git re PR middle-end/53695 (ICE: in dfs_enumerate_from, at cfganal.c:1221 with -O2 -ftracer and labels/gotos) 2012-10-29 Richard Guenther PR middle-end/53695 * tracer.c (tracer): Fixup loop structure. * cfgloopmanip.c (force_single_succ_latches): Add assert. (fix_loop_structure): Re-compute loop latches and disambiguate loops with multiple latches if required. * gcc.dg/torture/pr53695.c: New testcase. From-SVN: r192943 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 280e29a8529..e32ede06b0a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-10-29 Richard Guenther + + PR middle-end/53695 + * tracer.c (tracer): Fixup loop structure. + * cfgloopmanip.c (force_single_succ_latches): Add assert. + (fix_loop_structure): Re-compute loop latches and disambiguate + loops with multiple latches if required. + 2012-10-29 Uros Bizjak * config/i386/i386.c (ix86_decompose_address): Use simplify_gen_subreg diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index eae68ca43c7..b48e85883ce 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1586,6 +1586,7 @@ force_single_succ_latches (void) continue; e = find_edge (loop->latch, loop->header); + gcc_checking_assert (e != NULL); split_edge (e); } @@ -1848,6 +1849,32 @@ fix_loop_structure (bitmap changed_bbs) } } + /* Then re-compute the single latch if there is one. */ + FOR_EACH_LOOP (li, loop, 0) + { + edge_iterator ei; + edge e, latch = NULL; + FOR_EACH_EDGE (e, ei, loop->header->preds) + if (dominated_by_p (CDI_DOMINATORS, e->src, loop->header)) + { + if (!latch) + latch = e; + else + { + latch = NULL; + break; + } + } + if (latch + && latch->src->loop_father == loop) + loop->latch = latch->src; + else + loop->latch = NULL; + } + + if (!loops_state_satisfies_p (LOOPS_MAY_HAVE_MULTIPLE_LATCHES)) + disambiguate_loops_with_multiple_latches (); + if (loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS)) create_preheaders (CP_SIMPLE_PREHEADERS); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e1f365339b..d07052b6453 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-29 Richard Guenther + + PR middle-end/53695 + * gcc.dg/torture/pr53695.c: New testcase. + 2012-10-28 Jan Hubicka * gcc.dg/ipa/inlinehint-3.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/torture/pr53695.c b/gcc/testsuite/gcc.dg/torture/pr53695.c new file mode 100644 index 00000000000..eba0843c4a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr53695.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-ftracer" } */ + +void +foo (const void **p) +{ + void *labs[] = { &&l1, &&l2, &&l3 }; +l1: + goto *p++; +l2: + goto *p; +l3: + ; +} diff --git a/gcc/tracer.c b/gcc/tracer.c index 9b1d724085c..7264ad2589b 100644 --- a/gcc/tracer.c +++ b/gcc/tracer.c @@ -379,7 +379,12 @@ tracer (void) /* Trace formation is done on the fly inside tail_duplicate */ changed = tail_duplicate (); if (changed) - free_dominance_info (CDI_DOMINATORS); + { + free_dominance_info (CDI_DOMINATORS); + calculate_dominance_info (CDI_DOMINATORS); + if (current_loops) + fix_loop_structure (NULL); + } if (dump_file) brief_dump_cfg (dump_file, dump_flags);