> 
> The problem with the two states we had/have is that they are too extreme.
> 
> Our old one (i.e. those "mC" etc.) is too strong and doesn't have any
> backup in the standard, I think the PR101480 testcase is perfectly
> valid C++ and so it probably isn't a good idea to enable such behavior
> by default; with an extra switch sure, user promises not to rely on it
> and the optimization can be done.
> 
> The current one (i.e. those "m " etc.) are too weak, otherwise we wouldn't
> be discussing this PR, it really penalizes too much code in the wild.

I have WIP patch (which needs polishing for next stage 1) to extend
modref to detect functions doing allocations that does not escape to
global state as pure/const since allocation+deallocation should not be
observable.

Operator new with "mP" adds here extra twist.  We need to assume that
function reads global state (so everything globally accessible needs to
be stored to memory prior call) but its observable side-effects after
return does not depend on this.

So having "mP" default is extra complication here.  Not terribly bad -
we ignore the loads for value numbering and use them for DSE/DCE.

Honza

Reply via email to