This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Tree tail merging breaks __builtin_unreachable optimization
- From: Michael Matz <matz at suse dot de>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>, gcc-patches at gcc dot gnu dot org, tom at codesourcery dot com, Andrew Pinski <pinskia at gmail dot com>, Steven Bosscher <stevenb dot gcc at gmail dot com>, Richard Guenther <richard dot guenther at gmail dot com>
- Date: Thu, 5 Jul 2012 15:30:39 +0200 (CEST)
- Subject: Re: Tree tail merging breaks __builtin_unreachable optimization
- References: <201207041702.q64H2GGj017517@d06av02.portsmouth.uk.ibm.com> <4FF58D3E.4060105@mentor.com>
Hi,
On Thu, 5 Jul 2012, Tom de Vries wrote:
> The asserts allow the return result to be optimized, but not the cfg
> conditions.
>
> AFAIU, we can insert the asserts earlier. F.i., we can insert
> aD.1711_6 = ASSERT_EXPR <aD.1711_1(D), aD.1711_1(D) > 0>
> before the GIMPLE_COND in bb2.
Nope. That would require some more checks, in particular that the BB
containing builtin_unreachable doesn't contain any other side-effects.
Given this:
if (i < 0)
{ do_something_interesting();
__builtin_unreachable();
}
moving the assert before the if would remove the if condition, hence
the call to do_something_interesting. You need to retain side-effects if
there are any.
Ciao,
Michael.