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

--- Comment #13 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 25 Jan 2021, jason at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97474
> 
> --- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> ---
> Yeah, adding restrict there is just wrong; the constructor is called outside
> the function, and could e.g. stash a pointer to the object in a global
> variable.  What we actually want is to treat this reference parameter like a
> value parameter.  Is that information actually useful to the optimizers?

It's a layout hint PTA can use but without restricting who can point
to said object it's not going to affect precision much (in fact I'd
have to double check that giving hinting a wrong object size by
passing the base "value" of a derived class object won't cause issues).

ISTR we've explored keying on REFERENCE_TYPE only (for said layout hint)
in the past.

Reply via email to