Message ID | alpine.LNX.2.00.1012131806170.5687@monoid.intra.ispras.ru |
---|---|
State | New |
Headers | show |
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. >
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; +}