Hi Alan, On Sat, Aug 19, 2017 at 12:19:35AM +0930, Alan Modra wrote: > +Flushing registers to memory has performance implications and may be > +an issue for time-sensitive code. You can provide better information > +to GCC to avoid this, as shown in the following examples. At a > +minimum, aliasing rules allow GCC to know what memory @emph{doesn't} > +need to be flushed. Also, if GCC can prove that all of the outputs of > +a non-volatile @code{asm} statement are unused, then the @code{asm} > +may be deleted. Removal of otherwise dead @code{asm} statements will > +not happen if they clobber @code{"memory"}.
void f(int x) { int z; asm("hcf %0,%1" : "=r"(z) : "r"(x) : "memory"); } void g(int x) { int z; asm("hcf %0,%1" : "=r"(z) : "r"(x)); } Both f and g are completely removed by the first jump pass immediately after expand (via delete_trivially_dead_insns). Do you have a testcase for the behaviour you saw? Segher