[Bug rtl-optimization/111901] Apparently bogus CSE of inline asm with memory clobber

2023-10-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111901

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-10-22
 Status|UNCONFIRMED |NEW

--- Comment #5 from Andrew Pinski  ---
Confirmed. The inline-asm was merged between reload and postreload dump files .

[Bug rtl-optimization/111901] Apparently bogus CSE of inline asm with memory clobber

2023-10-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111901

--- Comment #4 from Andrew Pinski  ---
Looks like postreload_cse is causing the issue ...

[Bug rtl-optimization/111901] Apparently bogus CSE of inline asm with memory clobber

2023-10-20 Thread torvalds--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111901

--- Comment #3 from Linus Torvalds  ---
(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".

[Bug rtl-optimization/111901] Apparently bogus CSE of inline asm with memory clobber

2023-10-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111901

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||wrong-code
  Component|middle-end  |rtl-optimization
  Known to fail||4.9.0

--- Comment #2 from Andrew Pinski  ---
The gimple level is ok.