[PATCH] Fix PR 48374

Richard Guenther richard.guenther@gmail.com
Wed Jan 25 12:38:00 GMT 2012


2012/1/25 Andrey Belevantsev <abel@ispras.ru>:
> Hello,
>
> This patch fixes another problem with sel-sched not happy having bbs with
> zero successors.  Bootstrapped and tested on x86_64/linux.
>
> Again, this is not a regression as __builtin_unreachable did not exist
> before sel-sched, but the patch is very safe and obvious.  It is my fault
> not committing this earlier (the patch in the audit trail was created in
> April 2011).  What do release managers think?

Looks fine for me.

Richard.

> Andrey
>
> gcc/
> 2012-01-25  Andrey Belevantsev  <abel@ispras.ru>
>
>        PR rtl-optimization/48374
>        * sel-sched-ir.h (get_all_loop_exits): Check for zero successors.
>
> testsuite/
> 2012-01-25  Andrey Belevantsev  <abel@ispras.ru>
>
>        PR rtl-optimization/48374
>        * gcc.dg/pr48374.c: New test.
>
> diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
> index c8f8be6..ede08e4 100644
> --- a/gcc/sel-sched-ir.h
> +++ b/gcc/sel-sched-ir.h
> @@ -1119,7 +1119,8 @@ get_all_loop_exits (basic_block bb)
>   /* If bb is empty, and we're skipping to loop exits, then
>      consider bb as a possible gate to the inner loop now.  */
>   while (sel_bb_empty_or_nop_p (bb)
> -        && in_current_region_p (bb))
> +        && in_current_region_p (bb)
> +        && EDGE_COUNT (bb->succs) > 0)
>     {
>       bb = single_succ (bb);
>
> diff --git a/gcc/testsuite/gcc.dg/pr48374.c b/gcc/testsuite/gcc.dg/pr48374.c
> new file mode 100644
> index 0000000..24826d5
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr48374.c
> @@ -0,0 +1,17 @@
> +/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
> +/* { dg-options "-O -fschedule-insns2 -fsel-sched-pipelining
> -fsel-sched-pipelining-outer-loops -fselective-scheduling2 --param
> max-sched-extend-regions-iters=2"  } */
> +
> +void foo (int y)
> +{
> +  switch (y)
> +    {
> +    case 3:
> +    case 5:
> +    case 7:
> +    case 11:
> +      break;
> +    default:
> +      __builtin_unreachable ();
> +    }
> +}
> +
>



More information about the Gcc-patches mailing list