https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98925
--- Comment #1 from Jan Hubicka <hubicka at ucw dot cz> --- > If I don't overstimate modref and alias analysis destructor should disappear > completely in the example below (from https://gcc.gnu.org/PR98499#c4): > > struct string { > char * _M_buf; > // local store > char _M_local_buf[16]; > > __attribute__((noinline)) string() : _M_buf(_M_local_buf) {} > > ~string() { > if (_M_buf != _M_local_buf) > __builtin_trap(); > } > > string(const string &__str); // no copies > }; To see that _M_buf == _M_local_buf at the destruction time would require tracking the aggregate alue from the inlinined constructor to destructor which is something fitting to ipa-prop. Modref can helip in case _M_buf is initialized to NULL. In that case the address of return value would be non-escaping and we could optimize the if condition to true (is we did incorrectly before). I have WIP patch for this and will discuss with Martin Jambor the jump functions for return values. Thanks! Honza