OSDN Git Service

PR middle-end/44071
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 May 2010 18:17:43 +0000 (18:17 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:05:26 +0000 (14:05 +0900)
* cfglayout.c (fixup_reorder_chain): Allow asm goto to have
no fallthru edge.
* cfgcleanup.c (try_optimize_cfg): When in cfglayout mode
optimizing away empty bb with no successors, move over its
footer chain to fallthru predecessor.
* cfgrtl.c (patch_jump_insn): Update also REG_LABEL_OPERAND.
(rtl_split_edge): For asm goto call patch_jump_insn even if
splitting fallthru edge.

* c-c++-common/asmgoto-4.c: New test.
* gcc.target/i386/pr44071.c: New test.

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

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/testsuite/ChangeLog

index 16f56b8..24f210b 100644 (file)
@@ -1,5 +1,15 @@
 2010-05-11  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/44071
+       * cfglayout.c (fixup_reorder_chain): Allow asm goto to have
+       no fallthru edge.
+       * cfgcleanup.c (try_optimize_cfg): When in cfglayout mode
+       optimizing away empty bb with no successors, move over its
+       footer chain to fallthru predecessor.
+       * cfgrtl.c (patch_jump_insn): Update also REG_LABEL_OPERAND.
+       (rtl_split_edge): For asm goto call patch_jump_insn even if
+       splitting fallthru edge.
+
        PR c++/44059
        * config/elfos.h (ASM_DECLARE_OBJECT_NAME): Use qnu_unique_object
        even for DECL_ONE_ONLY DECL_ARTIFICIAL !TREE_READONLY decls.
index 7139e3a..75f5651 100644 (file)
@@ -1999,40 +1999,24 @@ try_optimize_cfg (int mode)
                      && single_succ_edge (ENTRY_BLOCK_PTR)->dest != b))
                {
                  c = b->prev_bb;
-                 if (EDGE_COUNT (b->preds) > 0)
+                 if ((mode & CLEANUP_CFGLAYOUT)
+                     && EDGE_COUNT (b->preds) > 0
+                     && b->il.rtl->footer
+                     && BARRIER_P (b->il.rtl->footer))
                    {
                      edge e;
                      edge_iterator ei;
 
-                     if (current_ir_type () == IR_RTL_CFGLAYOUT)
-                       {
-                         if (b->il.rtl->footer
-                             && BARRIER_P (b->il.rtl->footer))
-                           FOR_EACH_EDGE (e, ei, b->preds)
-                             if ((e->flags & EDGE_FALLTHRU)
-                                 && e->src->il.rtl->footer == NULL)
-                               {
-                                 if (b->il.rtl->footer)
-                                   {
-                                     e->src->il.rtl->footer = b->il.rtl->footer;
-                                     b->il.rtl->footer = NULL;
-                                   }
-                                 else
-                                   {
-                                     start_sequence ();
-                                     e->src->il.rtl->footer = emit_barrier ();
-                                     end_sequence ();
-                                   }
-                               }
-                       }
-                     else
-                       {
-                         rtx last = get_last_bb_insn (b);
-                         if (last && BARRIER_P (last))
-                           FOR_EACH_EDGE (e, ei, b->preds)
-                             if ((e->flags & EDGE_FALLTHRU))
-                               emit_barrier_after (BB_END (e->src));
-                       }
+                     FOR_EACH_EDGE (e, ei, b->preds)
+                       if (e->flags & EDGE_FALLTHRU)
+                         {
+                           if (e->src->il.rtl->footer == NULL)
+                             {
+                               e->src->il.rtl->footer = b->il.rtl->footer;
+                               b->il.rtl->footer = NULL;
+                             }
+                           break;
+                         }
                    }
                  delete_basic_block (b);
                  if (!(mode & CLEANUP_CFGLAYOUT))
index 8a74fd1..ee0fab8 100644 (file)
@@ -1,5 +1,9 @@
 2010-05-11  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/44071
+       * c-c++-common/asmgoto-4.c: New test.
+       * gcc.target/i386/pr44071.c: New test.
+
        PR c++/44062
        * c-c++-common/Wunused-var-7.c: New test.
        * g++.dg/warn/Wunused-var-9.C: New test.