]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/88470 (ICE in maybe_record_trace_start, at dwarf2cfi...
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 11:21:45 +0000 (13:21 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 11:21:45 +0000 (13:21 +0200)
Backported from mainline
2018-12-13  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/88470
* cfgcleanup.c (outgoing_edges_match): If the function is
shrink-wrapped and bb1 ends with a JUMP_INSN with a single fake
edge to EXIT, return false.

* gcc.target/i386/pr88470.c: New test.

From-SVN: r275080

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr88470.c [new file with mode: 0644]

index ef7ec9bba37444d825579ab99c22e8b8370af0aa..230038a4eb19fd37ba1e9a93739c998d8136a28f 100644 (file)
@@ -3,6 +3,11 @@
        Backported from mainline
        2018-12-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/88470
+       * cfgcleanup.c (outgoing_edges_match): If the function is
+       shrink-wrapped and bb1 ends with a JUMP_INSN with a single fake
+       edge to EXIT, return false.
+
        PR rtl-optimization/88416
        * valtrack.c (cleanup_auto_inc_dec): Handle pre/post-inc/dec/modify
        even if !AUTO_INC_DEC.
index f68a964e31e9389944ef9587d99edeb19965b70f..9f1b8432ea6da640f943967622835877a1d2cf83 100644 (file)
@@ -1620,10 +1620,13 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2)
   if (crtl->shrink_wrapped
       && single_succ_p (bb1)
       && single_succ (bb1) == EXIT_BLOCK_PTR_FOR_FN (cfun)
-      && !JUMP_P (BB_END (bb1))
+      && (!JUMP_P (BB_END (bb1))
+         /* Punt if the only successor is a fake edge to exit, the jump
+            must be some weird one.  */
+         || (single_succ_edge (bb1)->flags & EDGE_FAKE) != 0)
       && !(CALL_P (BB_END (bb1)) && SIBLING_CALL_P (BB_END (bb1))))
     return false;
-  
+
   /* If BB1 has only one successor, we may be looking at either an
      unconditional jump, or a fake edge to exit.  */
   if (single_succ_p (bb1)
index 5e9a10d5d50ca632afb24cc8b99dc9aa52dabca2..2dd25cb7c6ff65e5037d61e73a5410eafa39b9b6 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-12-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/88470
+       * gcc.target/i386/pr88470.c: New test.
+
        PR rtl-optimization/88416
        * gcc.target/i386/pr88416.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr88470.c b/gcc/testsuite/gcc.target/i386/pr88470.c
new file mode 100644 (file)
index 0000000..8d4400d
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/88470 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -maccumulate-outgoing-args -ftrapv -fno-ivopts -fno-reorder-blocks-and-partition" } */
+
+void
+foo (long x, long *y)
+{
+  long *a = y - 64, i;
+  for (i = 0; i < x; i++)
+    {
+      long v = y[i];
+      *a++ = v;
+    }
+  register void **c __asm__ ("di");
+  goto **c;
+}