This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Remove also 2nd argument for unused delete operator (PR tree-optimization/91270).
On Sun, Jul 28, 2019 at 4:57 PM Martin Liška <firstname.lastname@example.org> wrote:
> And there's one more patch that deals with delete operator
> which has a second argument (size). That definition GIMPLE
> statement of the size must be also properly marked.
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> Ready to be installed?
This isn't a proper fix. You can't mark a random operand as necessary
during elimination - this only works in very constraint cases. Here
it will break down if the stmt you just marked depends on another stmt
only used by the stmt you just marked (and thus also not necessary).
The fix is to propagate_necessity where you either have to excempt
the two-operator delete from handling or to mark its second operand
as necessary despite eventually deleting the call. You can avoid
this in case the allocation function used the exact same size argument.