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

--- Comment #3 from Linus Torvalds <torva...@linux-foundation.org> ---
(In reply to Andrew Pinski from comment #1)
> I suspect without an input, the cse will happen as there is no other writes
> in the loop.

Yes, it looks to me like the CSE simply didn't think of the memory clobber as a
possible side effect.

Other clobbers (ie registers) presumably don't affect whether something can be
CSE'd, so I do think that a memory clobber is special.

Of course, memory clobbers are special in other ways too (ie they force spills
and reloads of any pseudos around them), but my reaction to this is that it
does look like gcc has simply missed one other implication of a memory clobber.

Do I think it *matters* in practice? Probably not. Hopefully these kinds of asm
uses don't exist.

But I do find the resulting code generation surprising to the point of "that
looks buggy".

Reply via email to