diff mbox

Fix sel-sched ICE with __builtin_unreachable (PR rtl-optimization/45353)

Message ID 20100820154946.GD702@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Aug. 20, 2010, 3:49 p.m. UTC
Hi!

The testcase in the patch ICEs, because with __builtin_unreachable ()
there is a basic block containing just notes, followed by BARRIER, and
BARRIER doesn't have BLOCK_FOR_INSN.  BARRIERs are always after the bb
though, so we should handle it like BLOCK_FOR_INSN (head) != bb.

Bootstrapped/regtested on x86_64-linux and i686-linux with yes,rtl checking,
ok for trunk?

2010-08-20  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/45353
	* sel-sched-ir.c (sel_bb_head): Return NULL even if next_nonnote_insn
	after bb_note is a BARRIER.

	* gcc.dg/pr45353.c: New test.


	Jakub

Comments

Vladimir Makarov Aug. 20, 2010, 5:16 p.m. UTC | #1
On 08/20/2010 11:49 AM, Jakub Jelinek wrote:
> Hi!
>
> The testcase in the patch ICEs, because with __builtin_unreachable ()
> there is a basic block containing just notes, followed by BARRIER, and
> BARRIER doesn't have BLOCK_FOR_INSN.  BARRIERs are always after the bb
> though, so we should handle it like BLOCK_FOR_INSN (head) != bb.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux with yes,rtl checking,
> ok for trunk?
>
>    
Sure.  Thanks, Jakub.
> 2010-08-20  Jakub Jelinek<jakub@redhat.com>
>
> 	PR rtl-optimization/45353
> 	* sel-sched-ir.c (sel_bb_head): Return NULL even if next_nonnote_insn
> 	after bb_note is a BARRIER.
>
> 	* gcc.dg/pr45353.c: New test.
>
> --- gcc/sel-sched-ir.c.jj	2010-07-09 13:44:24.000000000 +0200
> +++ gcc/sel-sched-ir.c	2010-08-20 14:14:57.000000000 +0200
> @@ -4326,7 +4326,7 @@ sel_bb_head (basic_block bb)
>         note = bb_note (bb);
>         head = next_nonnote_insn (note);
>
> -      if (head&&  BLOCK_FOR_INSN (head) != bb)
> +      if (head&&  (BARRIER_P (head) || BLOCK_FOR_INSN (head) != bb))
>   	head = NULL_RTX;
>       }
>
> --- gcc/testsuite/gcc.dg/pr45353.c.jj	2010-08-20 14:17:44.000000000 +0200
> +++ gcc/testsuite/gcc.dg/pr45353.c	2010-08-20 14:17:24.000000000 +0200
> @@ -0,0 +1,9 @@
> +/* PR rtl-optimization/45353 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fschedule-insns -fselective-scheduling" } */
> +
> +void
> +foo ()
> +{
> +  __builtin_unreachable ();
> +}
>
> 	Jakub
>
diff mbox

Patch

--- gcc/sel-sched-ir.c.jj	2010-07-09 13:44:24.000000000 +0200
+++ gcc/sel-sched-ir.c	2010-08-20 14:14:57.000000000 +0200
@@ -4326,7 +4326,7 @@  sel_bb_head (basic_block bb)
       note = bb_note (bb);
       head = next_nonnote_insn (note);
 
-      if (head && BLOCK_FOR_INSN (head) != bb)
+      if (head && (BARRIER_P (head) || BLOCK_FOR_INSN (head) != bb))
 	head = NULL_RTX;
     }
 
--- gcc/testsuite/gcc.dg/pr45353.c.jj	2010-08-20 14:17:44.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr45353.c	2010-08-20 14:17:24.000000000 +0200
@@ -0,0 +1,9 @@ 
+/* PR rtl-optimization/45353 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fschedule-insns -fselective-scheduling" } */
+
+void
+foo ()
+{
+  __builtin_unreachable ();
+}