https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64317
Ilya Enkovich <enkovich.gnu at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |enkovich.gnu at gmail dot com
--- Comment #3 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
Created attachment 34675
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34675&action=edit
Another reproducer
I found one more reproducer for the problem. Generated code for multiple
'output' calls inlined into test':
..
.L5:
movl 28(%esp), %edx <-- load PIC reg
movl %edi, (%ecx)
leal (%ebx,%eax), %ecx
cmpl %ecx, %ebp
movl %ebx, out_pos@GOTOFF(%edx)
movl val3@GOTOFF(%edx), %edi
jnb .L6
movl 28(%esp), %ebx <-- have value in EDX
movl out@GOTOFF(%ebx), %ebx
leal (%ebx,%eax), %ecx
.L6:
movl 28(%esp), %edx <-- NOP
movl %edi, (%ebx)
leal (%ecx,%eax), %ebx
cmpl %ebx, %ebp
movl %ecx, out_pos@GOTOFF(%edx)
movl val4@GOTOFF(%edx), %edi
jnb .L7
movl 28(%esp), %ecx <-- have value in EDX
movl out@GOTOFF(%ecx), %ecx
leal (%ecx,%eax), %ebx
.L7:
movl 28(%esp), %edx <-- NOP
movl %edi, (%ecx)
...
BTW if I put __attribute__((noinline)) for crc32 function then mentioned code
becomes better and we don't have these two useless instructions in each
function instance.
Compilation string:
gcc -Ofast -funroll-loops -m32 -march=slm -fPIE test.i -S
Used compiler:
gcc version 5.0.0 20150203 (experimental) (GCC)