From: Jakub Jelinek Date: Thu, 11 Feb 2016 09:12:52 +0000 (+0100) Subject: backport: re PR target/69015 (ICE: RTL check: expected code 'code_label', have 'retur... X-Git-Tag: releases/gcc-4.9.4~340 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9acc17238415bca96886f73a2b20146adcf439a;p=thirdparty%2Fgcc.git backport: re PR target/69015 (ICE: RTL check: expected code 'code_label', have 'return' in find_cond_trap, at ifcvt.c:3715 with -fno-if-conversion and __builtin_trap()) Backported from mainline 2016-01-01 Jakub Jelinek PR target/69015 * ifcvt.c (find_cond_trap): Give up if returnjump_p (jump). * gcc.dg/pr69015.c: New test. From-SVN: r233325 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 295408e4e753..7f4438cf3889 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,11 @@ 2016-02-11 Jakub Jelinek Backported from mainline + 2016-01-01 Jakub Jelinek + + PR target/69015 + * ifcvt.c (find_cond_trap): Give up if returnjump_p (jump). + 2015-12-10 Jakub Jelinek PR rtl-optimization/68376 diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index ad436d7f97d5..b3395691e00e 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a146cb46680a..df038e92f9d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2016-02-11 Jakub Jelinek Backported from mainline + 2016-01-01 Jakub Jelinek + + PR target/69015 + * gcc.dg/pr69015.c: New test. + 2015-12-10 Jakub Jelinek PR rtl-optimization/68376 diff --git a/gcc/testsuite/gcc.dg/pr69015.c b/gcc/testsuite/gcc.dg/pr69015.c new file mode 100644 index 000000000000..9e75db9d0e75 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69015.c @@ -0,0 +1,10 @@ +/* PR target/69015 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-if-conversion" } */ + +void +foo (int c) +{ + if (c) + __builtin_trap (); +}