]> 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 17:37:06 +0000 (18:37 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Feb 2015 17:37:06 +0000 (18:37 +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.

From-SVN: r220328

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

index 13763900ee2c9e89abed5d522616cfd4103e4de1..76660050f65886da7018c2feebc1a2a53e70f90e 100644 (file)
@@ -1,6 +1,12 @@
 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.
+
        2015-01-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/64421
index e6dabd05c5c3cf6429cf82804f00eed4a2ed6f72..d41373b94069063d474c39154880535759ca607e 100644 (file)
@@ -133,7 +133,30 @@ cleanup_barriers (void)
          if (BARRIER_P (prev))
            delete_insn (insn);
          else if (prev != PREV_INSN (insn))
-           reorder_insns_nobb (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 193f611bbd6e5ee258bdd535bc078ac9a191ce38..b5dab480b1fae819cfc04ebecf1d22eda94aee22 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 ();
+}