OSDN Git Service

gcc/
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Feb 2005 01:28:59 +0000 (01:28 +0000)
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Feb 2005 01:28:59 +0000 (01:28 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95431 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr20017.c [new file with mode: 0644]

index 68199d0..b83b79a 100644 (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
index 695e490..956885a 100644 (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);
     }
index 1a64436..91b54b0 100644 (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
diff --git a/gcc/testsuite/gcc.dg/pr20017.c b/gcc/testsuite/gcc.dg/pr20017.c
new file mode 100644 (file)
index 0000000..ee425f5
--- /dev/null
@@ -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;
+}