re PR rtl-optimization/20017 (internal compiler error: in rtl_verify_flow_info, at cfgrtl.c:2212)

gcc/
	PR rtl-optimization/20017.
	* passes.c (rest_of_handle_combine, rest_of_handle_cse,
	rest_of_handle_cse2, rest_of_handle_gcse): Call
	delete_dead_jumptables immediately before calling cleanup_cfg.

testsuite/
	PR rtl-optimization/20017.
	* gcc.dg/pr20017.c: New.

From-SVN: r95431
This commit is contained in:
Kazu Hirata 2005-02-23 01:28:59 +00:00 committed by Kazu Hirata
parent 263fb23d4a
commit 78d5a34be5
4 changed files with 59 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2005-02-22 Kazu Hirata <kazu@cs.umass.edu>
PR rtl-optimization/20017.
* passes.c (rest_of_handle_combine, rest_of_handle_cse,
rest_of_handle_cse2, rest_of_handle_gcse): Call
delete_dead_jumptables immediately before calling cleanup_cfg.
2005-02-22 Devang Patel <dpatel@apple.com>
PR 19952

View File

@ -895,6 +895,7 @@ rest_of_handle_combine (void)
rebuild_jump_labels (get_insns ());
timevar_pop (TV_JUMP);
delete_dead_jumptables ();
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
}
@ -971,6 +972,9 @@ rest_of_handle_cse (void)
expecting CSE to be run. But always rerun it in a cheap mode. */
cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse;
if (tem)
delete_dead_jumptables ();
if (tem || optimize > 1)
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
@ -1006,6 +1010,7 @@ rest_of_handle_cse2 (void)
{
timevar_push (TV_JUMP);
rebuild_jump_labels (get_insns ());
delete_dead_jumptables ();
cleanup_cfg (CLEANUP_EXPENSIVE);
timevar_pop (TV_JUMP);
}
@ -1053,6 +1058,7 @@ rest_of_handle_gcse (void)
{
timevar_push (TV_JUMP);
rebuild_jump_labels (get_insns ());
delete_dead_jumptables ();
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
timevar_pop (TV_JUMP);
}

View File

@ -1,3 +1,8 @@
2005-02-22 Kazu Hirata <kazu@cs.umass.edu>
PR rtl-optimization/20017.
* gcc.dg/pr20017.c: New.
2005-02-22 Devang Patel <dpatel@apple.com>
PR 19952

View File

@ -0,0 +1,41 @@
/* PR rtl-optimization/20017
After CSE/GCSE folds a switch statement to an unconditonal jump,
cfg_cleanup did not remove a dead jump table, confusing the CFG
layout code later on. */
/* { dg-do compile } */
/* { dg-options "-O1" } */
/* { dg-options "-O1 -march=i386" { target { i?86-*-* && ilp32 } } } */
int
foo (int *buf, int *p)
{
int result;
const int *tmp;
if (*buf)
return 1;
result = 2;
*buf = 2;
tmp = buf;
switch (*tmp)
{
case 3:
case 4:
case 6:
case 14:
return 1;
case 0:
result = *p;
/* Fall through. */
default:
if (result)
return 1;
}
return 0;
}