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

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> I guess the "usual" way of dealing with this would be to have
> CLOBBERs for all VLAs before the __builtin_stack_restore.

That looks like a good idea.

I didn't try to follow in a debugger why DSE fails to remove the write when
those 2 builtins are present while it manages if I call
__builtin_alloca_with_align directly, but I don't immediately see a reason for
that difference, even in the absence of clobbers. Or maybe that's just the
usual limitations of DSE (there is a branch after all...).

I first thought that __builtin_stack_save/restore might need some extra
attributes (advertising for instance that they do not read/write memory or let
anything escape, without weakening them to the point where the compiler would
move them around too much or remove them), but since the call to the opaque g
does not seem to prevent DSE from removing the write, that's probably not the
issue.

Reply via email to