gcc/testsuite/ChangeLog:
authorspark <spark@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Nov 2007 17:02:43 +0000 (17:02 +0000)
committerspark <spark@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Nov 2007 17:02:43 +0000 (17:02 +0000)
2007-11-30  Martin Michlmayr <tbm@cyrius.com>

PR rtl-optimization/34171
* gcc.dg/pr34171.c: New testcase.

gcc/ChangeLog:

2007-11-30  Seongbae Park <seongbae.park@gmail.com>

PR rtl-optimization/34171
* cfgrtl.c (update_bb_for_insn_chain): New function,
refactored from update_bb_for_insn.
(update_bb_for_insn): Call update_bb_for_insn.
(rtl_merge_blocks, try_redirect_by_replacing_jump):
Replace a loop with update_bb_for_insn_chain call.
(cfg_layout_merge_blocks): Add a call to
update_bb_for_insn_chain. Replace the for loop
with a call to update_bb_for_insn_chain.

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

gcc/ChangeLog
gcc/cfgrtl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr34171.c [new file with mode: 0644]

index ab14904..015ec36 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-30  Seongbae Park <seongbae.park@gmail.com>
+
+       PR rtl-optimization/34171
+       * cfgrtl.c (update_bb_for_insn_chain): New function,
+       refactored from update_bb_for_insn.
+       (update_bb_for_insn): Call update_bb_for_insn.
+       (rtl_merge_blocks, try_redirect_by_replacing_jump):
+       Replace a loop with update_bb_for_insn_chain call.
+       (cfg_layout_merge_blocks): Add a call to
+       update_bb_for_insn_chain. Replace the for loop
+       with a call to update_bb_for_insn_chain.
+
 2007-11-30  Ben Elliston  <bje@au.ibm.com>
 
        * config/vax/vax.h (ASM_FORMAT_PRIVATE_NAME): Remove. Use default.
index b5a432e..1b9c505 100644 (file)
@@ -465,24 +465,36 @@ emit_insn_at_entry (rtx insn)
   commit_edge_insertions ();
 }
 
-/* Update insns block within BB.  */
+/* Update BLOCK_FOR_INSN of insns between BEGIN and END
+   (or BARRIER if found) and notify df of the bb change. 
+   The insn chain range is inclusive
+   (i.e. both BEGIN and END will be updated. */
 
-void
-update_bb_for_insn (basic_block bb)
+static void
+update_bb_for_insn_chain (rtx begin, rtx end, basic_block bb)
 {
   rtx insn;
 
-  for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
+  end = NEXT_INSN (end);
+  for (insn = begin; insn != end; insn = NEXT_INSN (insn))
     {
       if (!BARRIER_P (insn))
        {
          set_block_for_insn (insn, bb);
          df_insn_change_bb (insn);
        }
-      if (insn == BB_END (bb))
-       break;
     }
 }
+
+/* Update BLOCK_FOR_INSN of insns in BB to BB,
+   and notify df of the change.  */
+
+void
+update_bb_for_insn (basic_block bb)
+{
+  update_bb_for_insn_chain (BB_HEAD (bb), BB_END (bb), bb);
+}
+
 \f
 /* Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK
    note associated with the BLOCK.  */
@@ -629,16 +641,7 @@ rtl_merge_blocks (basic_block a, basic_block b)
   /* Reassociate the insns of B with A.  */
   if (!b_empty)
     {
-      rtx x;
-
-      for (x = a_end; x != b_end; x = NEXT_INSN (x))
-       {
-         set_block_for_insn (x, a);
-         df_insn_change_bb (x);
-       }
-
-      set_block_for_insn (b_end, a);
-      df_insn_change_bb (b_end);
+      update_bb_for_insn_chain (a_end, b_end, a);
 
       a_end = b_end;
     }
@@ -843,14 +846,9 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
                 which originally were or were created before jump table are
                 inside the basic block.  */
              rtx new_insn = BB_END (src);
-             rtx tmp;
 
-             for (tmp = NEXT_INSN (BB_END (src)); tmp != barrier;
-                  tmp = NEXT_INSN (tmp))
-               {
-                 set_block_for_insn (tmp, src);
-                 df_insn_change_bb (tmp);
-               }
+             update_bb_for_insn_chain (NEXT_INSN (BB_END (src)),
+                                       PREV_INSN (barrier), src);
 
              NEXT_INSN (PREV_INSN (new_insn)) = NEXT_INSN (new_insn);
              PREV_INSN (NEXT_INSN (new_insn)) = PREV_INSN (new_insn);
@@ -2637,6 +2635,13 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
        first = NEXT_INSN (first);
       gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first));
       BB_HEAD (b) = NULL;
+
+      /* emit_insn_after_noloc doesn't call df_insn_change_bb.
+         We need to explicitly call. */
+      update_bb_for_insn_chain (NEXT_INSN (first),
+                               BB_END (b),
+                               a);
+
       delete_insn (first);
     }
   /* Otherwise just re-associate the instructions.  */
@@ -2644,13 +2649,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
     {
       rtx insn;
 
-      for (insn = BB_HEAD (b);
-          insn != NEXT_INSN (BB_END (b));
-          insn = NEXT_INSN (insn))
-       {
-         set_block_for_insn (insn, a);
-         df_insn_change_bb (insn);
-       }
+      update_bb_for_insn_chain (BB_HEAD (b), BB_END (b), a);
 
       insn = BB_HEAD (b);
       /* Skip possible DELETED_LABEL insn.  */
index 9a9a2ad..59de2c5 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-30  Martin Michlmayr <tbm@cyrius.com>
+
+       PR rtl-optimization/34171
+       * gcc.dg/pr34171.c: New testcase.
+
 2007-11-30  Zdenek Dvorak  <ook@ucw.cz>
 
        * gcc.dg/tree-ssa/pr34244.c: Fixed.
diff --git a/gcc/testsuite/gcc.dg/pr34171.c b/gcc/testsuite/gcc.dg/pr34171.c
new file mode 100644 (file)
index 0000000..6013a0d
--- /dev/null
@@ -0,0 +1,27 @@
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+extern char coredump;
+extern void sigemptyset (char *);
+struct sigaction
+{
+  char sa_mask;
+};
+void doSignalsSetup (void)
+{
+  static const int signals[] = {
+    1, 2, 3, 4, 6, 8, 11, 13, 14, 15, 30 , 31
+  };
+  unsigned int i, sig;
+  struct sigaction sa;
+  for (i = 0; i < sizeof (signals) / sizeof (int); i++)
+    {
+      sig = signals[i];
+      if (coredump &&
+          (sig == 4 || sig == 8 || sig == 11 || sig == 10))
+        continue;
+      sigemptyset (&sa.sa_mask);
+    }
+}