[Bug inline-asm/87984] [7/8/9 Regression] wrong code for local reg var input to asm
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 3 16:43:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87984
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For #c9, looks like FRE bug to me, which is optimizing correct:
a = 1;
__asm__("add %1, %0" : "=r" o_12 : "r" a, "0" 0);
__asm__ __volatile__("xor %%eax, %%eax" : : : "eax");
i_13 = 1;
a = 1;
__asm__("add %1, %0" : "=r" o_18 : "r" a, "0" o_12);
__asm__ __volatile__("xor %%eax, %%eax" : : : "eax");
i_19 = 2;
a = 1;
__asm__("add %1, %0" : "=r" o_24 : "r" a, "0" o_18);
__asm__ __volatile__("xor %%eax, %%eax" : : : "eax");
i_25 = 3;
return o_24;
into:
a = 1;
__asm__("add %1, %0" : "=r" o_12 : "r" a, "0" 0);
__asm__ __volatile__("xor %%eax, %%eax" : : : "eax");
__asm__("add %1, %0" : "=r" o_18 : "r" a, "0" o_12);
__asm__ __volatile__("xor %%eax, %%eax" : : : "eax");
__asm__("add %1, %0" : "=r" o_24 : "r" a, "0" o_18);
__asm__ __volatile__("xor %%eax, %%eax" : : : "eax");
return o_24;
We should treat function calls and inline asm (just with clobbers or all?
Argument for all is that e.g. for fixed registers there is no need to specify
them in clobbers, but users might still use those fixed registers in asm) as
possibly modifying content of local or global register vars.
More information about the Gcc-bugs
mailing list