> The support to elide calls to allocation functions in DCE runs into
> the issue that when implementations are discovered noreturn we end
> up DCEing the calls anyway, leaving blocks without termination and
> without outgoing edges which is both invalid IL and wrong-code when
> as in the example the noreturn call would throw.  The following
> avoids taking advantage of both noreturn and the ability to elide
> allocation at the same time.
> 
> For the testcase it's valid to throw or return 10 by eliding the
> allocation.  But we have to do either where currently we'd run
> off the function.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> Honza, any objections here?

Looks good to me.  Optimizing out noreturn new seems like odd
optimization anyway.

Honza
> 
> Thanks,
> Richard.
> 
>       PR tree-optimization/111773
>       * tree-ssa-dce.cc (mark_stmt_if_obviously_necessary): Do
>       not elide noreturn calls that are reflected to the IL.
> 
>       * g++.dg/torture/pr111773.C: New testcase.

Reply via email to