This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Tree tail merging breaks __builtin_unreachable optimization


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]