public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR46875] sel-sched: don't try to remove tablejumps
@ 2010-12-13 16:25 Alexander Monakov
  2010-12-13 23:06 ` Vladimir Makarov
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Monakov @ 2010-12-13 16:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Vladimir N. Makarov

Hi,

This fixes a fallout from my previous sel-sched patch (PR45354).  I've relaxed
jump type checking in bb_has_removable_jump_to_p, and as a result sel-sched
would try to remove degenerate tablejumps (if their only destination is the
next basic block).  However, tidy_fallthru_edge would not mark the edge
fallthrough because of the jump table that is left in the insn stream between
basic blocks, causing an ICE in verify_flow_info.

The patch adjusts the check in bb_has_removable_jump_to_p to not consider
tablejumps for deletion.  It also adjusts dumping of jump tables in "slim"
mode (it currently just prints garbage, the patch changes it to "sequence").

Bootstrapped and regtested on x86_64-linux, OK for trunk?

2010-12-13  Alexander Monakov  <amonakov@ispras.ru>

	PR rtl-optimization/46875
	* sched-vis.c (print_pattern): Dump "sequence" for ADDR_VECs.
	* sel-sched-ir.c (bb_has_removable_jump_to_p): Forbid table jumps.

testsuite:
	gcc.dg/pr46875.c: New.

diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index 83c423a..d4a5644 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -604,7 +604,7 @@ print_pattern (char *buf, const_rtx x, int verbose)
       sprintf (buf, "asm {%s}", XSTR (x, 0));
       break;
     case ADDR_VEC:
-      break;
+      /* Fall through.  */
     case ADDR_DIFF_VEC:
       print_value (buf, XEXP (x, 0), verbose);
       break;
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 2696882..427fd22 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -6109,7 +6109,8 @@ sel_is_loop_preheader_p (basic_block bb)
 static bool
 bb_has_removable_jump_to_p (basic_block jump_bb, basic_block dest_bb)
 {
-  if (!onlyjump_p (BB_END (jump_bb)))
+  if (!onlyjump_p (BB_END (jump_bb))
+      || tablejump_p (BB_END (jump_bb), NULL, NULL))
     return false;
 
   /* Several outgoing edges, abnormal edge or destination of jump is
diff --git a/gcc/testsuite/gcc.dg/pr46875.c b/gcc/testsuite/gcc.dg/pr46875.c
new file mode 100644
index 0000000..c601708
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr46875.c
@@ -0,0 +1,27 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
+/* { dg-options "-Os -fselective-scheduling2" } */
+
+long
+foo (int x, long *y)
+{
+  long a = 0;
+  switch (x)
+    {
+    case 0:
+      a = *y;
+      break;
+    case 1:
+      a = *y;
+      break;
+    case 2:
+      a = *y;
+      break;
+    case 3:
+      a = *y;
+      break;
+    case 4:
+      a = *y;
+      break;
+    }
+  return a;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR46875] sel-sched: don't try to remove tablejumps
  2010-12-13 16:25 [PR46875] sel-sched: don't try to remove tablejumps Alexander Monakov
@ 2010-12-13 23:06 ` Vladimir Makarov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Makarov @ 2010-12-13 23:06 UTC (permalink / raw)
  To: Alexander Monakov; +Cc: gcc-patches

On 12/13/2010 10:25 AM, Alexander Monakov wrote:
> Hi,
>
> This fixes a fallout from my previous sel-sched patch (PR45354).  I've relaxed
> jump type checking in bb_has_removable_jump_to_p, and as a result sel-sched
> would try to remove degenerate tablejumps (if their only destination is the
> next basic block).  However, tidy_fallthru_edge would not mark the edge
> fallthrough because of the jump table that is left in the insn stream between
> basic blocks, causing an ICE in verify_flow_info.
>
> The patch adjusts the check in bb_has_removable_jump_to_p to not consider
> tablejumps for deletion.  It also adjusts dumping of jump tables in "slim"
> mode (it currently just prints garbage, the patch changes it to "sequence").
>
> Bootstrapped and regtested on x86_64-linux, OK for trunk?
>
Ok, thanks.
> 2010-12-13  Alexander Monakov<amonakov@ispras.ru>
>
> 	PR rtl-optimization/46875
> 	* sched-vis.c (print_pattern): Dump "sequence" for ADDR_VECs.
> 	* sel-sched-ir.c (bb_has_removable_jump_to_p): Forbid table jumps.
>
> testsuite:
> 	gcc.dg/pr46875.c: New.
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-13 21:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-13 16:25 [PR46875] sel-sched: don't try to remove tablejumps Alexander Monakov
2010-12-13 23:06 ` Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).