From f1e0620c75721bdec94af311943025ee8474a57e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 1 Jan 2016 00:51:50 +0100 Subject: [PATCH] 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()) PR target/69015 * ifcvt.c (find_cond_trap): Give up if returnjump_p (jump). * gcc.dg/pr69015.c: New test. From-SVN: r232020 --- gcc/ChangeLog | 4 ++++ gcc/ifcvt.c | 7 +++++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/pr69015.c | 10 ++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr69015.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 941f9818b57..32d3ecf545e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-01-01 Jakub Jelinek + + PR target/69015 + * ifcvt.c (find_cond_trap): Give up if returnjump_p (jump). Copyright (C) 2016 Free Software Foundation, Inc. diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 6164232c0c5..1112ad0df39 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 941f9818b57..178c13ee2d9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-01-01 Jakub Jelinek + + PR target/69015 + * gcc.dg/pr69015.c: New test. 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 index 00000000000..9e75db9d0e7 --- /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 (); +} -- 2.30.2