]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/61058 (ICE: RTL check: expected elt 3 type 'B',...
authorJakub Jelinek <jakub@redhat.com>
Sun, 1 Feb 2015 21:56:03 +0000 (22:56 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Feb 2015 21:56:03 +0000 (22:56 +0100)
Backported from mainline
2015-01-27  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/61058
* jump.c (cleanup_barriers): Update basic block boundaries
if BLOCK_FOR_INSN is non-NULL on PREV.

* gcc.dg/pr61058.c: New test.

2013-04-16  Steven Bosscher  <steven@gcc.gnu.org>

PR middle-end/43631
* jump.c (cleanup_barriers): Use reorder_insns_nobb to avoid making
the moved barrier the tail of the basic block it follows.

From-SVN: r220336

gcc/ChangeLog
gcc/jump.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr61058.c [new file with mode: 0644]

index 1de6c3960f9335117469345fcd0a54cd03bfadec..246c8d7d90675510f708c2a3f385c619f31fff54 100644 (file)
@@ -1,6 +1,18 @@
 2015-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2015-01-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/61058
+       * jump.c (cleanup_barriers): Update basic block boundaries
+       if BLOCK_FOR_INSN is non-NULL on PREV.
+
+       2013-04-16  Steven Bosscher  <steven@gcc.gnu.org>
+
+       PR middle-end/43631
+       * jump.c (cleanup_barriers): Use reorder_insns_nobb to avoid making
+       the moved barrier the tail of the basic block it follows.
+
        2015-01-26  Jakub Jelinek  <jakub@redhat.com>
 
        * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add
index 54d98605dfc4d29f659d451c76c4e24ced236a1d..8a0b5811b5c66b378f1714a0922ab5b6f0f33c46 100644 (file)
@@ -133,7 +133,30 @@ cleanup_barriers (void)
          if (BARRIER_P (prev))
            delete_insn (insn);
          else if (prev != PREV_INSN (insn))
-           reorder_insns (insn, insn, prev);
+           {
+             basic_block bb = BLOCK_FOR_INSN (prev);
+             rtx end = PREV_INSN (insn);
+             reorder_insns_nobb (insn, insn, prev);
+             if (bb)
+               {
+                 /* If the backend called in machine reorg compute_bb_for_insn
+                    and didn't free_bb_for_insn again, preserve basic block
+                    boundaries.  Move the end of basic block to PREV since
+                    it is followed by a barrier now, and clear BLOCK_FOR_INSN
+                    on the following notes.
+                    ???  Maybe the proper solution for the targets that have
+                    cfg around after machine reorg is not to run cleanup_barriers
+                    pass at all.  */
+                 BB_END (bb) = prev;
+                 do
+                   {
+                     prev = NEXT_INSN (prev);
+                     if (prev != insn && BLOCK_FOR_INSN (prev) == bb)
+                       BLOCK_FOR_INSN (prev) = NULL;
+                   }
+                 while (prev != end);
+               }
+           }
        }
     }
   return 0;
index d78cf365d6caf03dd086eec86580a8b18956028c..f0d9e5e328dc05c7a5fc6b821e37d53804a9915f 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2015-01-27  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/61058
+       * gcc.dg/pr61058.c: New test.
+
        PR c/64766
        * gcc.dg/pr64766.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr61058.c b/gcc/testsuite/gcc.dg/pr61058.c
new file mode 100644 (file)
index 0000000..6f840f4
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR rtl-optimization/61058 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-additional-options "-fno-asynchronous-unwind-tables -mtune=atom" { target i?86-*-* x86_64-*-* } } */
+
+void
+foo (void)
+{
+  __builtin_unreachable ();
+}