]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/69015 (ICE: RTL check: expected code 'code_label', have 'retur...
authorJakub Jelinek <jakub@redhat.com>
Thu, 11 Feb 2016 09:12:52 +0000 (10:12 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 11 Feb 2016 09:12:52 +0000 (10:12 +0100)
Backported from mainline
2016-01-01  Jakub Jelinek  <jakub@redhat.com>

PR target/69015
* ifcvt.c (find_cond_trap): Give up if returnjump_p (jump).

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

From-SVN: r233325

gcc/ChangeLog
gcc/ifcvt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr69015.c [new file with mode: 0644]

index 295408e4e7532cde39e7346ea8c2519848765d6a..7f4438cf3889d44863c67821bb7982a76750b71b 100644 (file)
@@ -1,6 +1,11 @@
 2016-02-11  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/69015
+       * ifcvt.c (find_cond_trap): Give up if returnjump_p (jump).
+
        2015-12-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/68376
index ad436d7f97d5b8dd0f3b5c16a482847d7a6e7934..b3395691e00ec98d18a86fcd46c218099c793469 100644 (file)
@@ -3729,8 +3729,11 @@ find_cond_trap (basic_block test_bb, edge then_edge, edge else_edge)
     return FALSE;
 
   /* If the conditional jump is more than just a conditional jump, then
-     we can not do if-conversion on this block.  */
-  if (! onlyjump_p (jump))
+     we can not do if-conversion on this block.  Give up for returnjump_p,
+     changing a conditional return followed by unconditional trap for
+     conditional trap followed by unconditional return is likely not
+     beneficial and harder to handle.  */
+  if (! onlyjump_p (jump) || returnjump_p (jump))
     return FALSE;
 
   /* We must be comparing objects whose modes imply the size.  */
index a146cb46680a7f20b8d6009b5d6fe35c6b05386c..df038e92f9d163a9bd240d4781bb502b0ce2c12e 100644 (file)
@@ -1,6 +1,11 @@
 2016-02-11  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/69015
+       * gcc.dg/pr69015.c: New test.
+
        2015-12-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/68376
diff --git a/gcc/testsuite/gcc.dg/pr69015.c b/gcc/testsuite/gcc.dg/pr69015.c
new file mode 100644 (file)
index 0000000..9e75db9
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR target/69015 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-if-conversion" } */
+
+void
+foo (int c)
+{
+  if (c)
+    __builtin_trap ();
+}