PR target/69015
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Dec 2015 23:51:50 +0000 (23:51 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Dec 2015 23:51:50 +0000 (23:51 +0000)
* ifcvt.c (find_cond_trap): Give up if returnjump_p (jump).

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

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

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

index 941f981..32d3ecf 100644 (file)
@@ -1,3 +1,7 @@
+2016-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/69015
+       * ifcvt.c (find_cond_trap): Give up if returnjump_p (jump).
 \f
 Copyright (C) 2016 Free Software Foundation, Inc.
 
index 6164232..1112ad0 100644 (file)
@@ -4526,8 +4526,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 941f981..178c13e 100644 (file)
@@ -1,3 +1,7 @@
+2016-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/69015
+       * gcc.dg/pr69015.c: New test.
 \f
 Copyright (C) 2016 Free Software Foundation, Inc.
 
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 ();
+}