[Bug tree-optimization/109945] Escape analysis hates copy elision: different result with -O1 vs -O2

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 24 08:16:11 GMT 2023


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109945

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #13)
> with the former for -m64 and the latter for -m32 only seems to be the
> only fallout here.

It will penalize C and other languages without mandatory NRV in the FEs,
without that I think the address can't escape (taking address then would either
prevent tree-nrv.cc or
even if not, would be still considered taking address of a local variable).
Perhaps we could remember in some FUNCTION_DECL bit whether mandatory NRV was
done and
least for the cases where we know the callee, we know it hasn't done NRV and
!TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt)))) we could avoid this.
But perhaps it is an overkill.


More information about the Gcc-bugs mailing list