var-tracking wrt. leaf regs on sparc

David Miller davem@davemloft.net
Thu Feb 7 23:51:00 GMT 2013


From: Jakub Jelinek <jakub@redhat.com>
Date: Thu, 7 Feb 2013 20:43:32 +0100

> This and earlier patch are ok, if it bootstraps/regtests fine, and suitable
> ChangeLog entry is provided.
> Running gdb testsuite before and after wouldn't hurt though.

I've done all of this, and committed to trunk and the gcc-4.7 branch,
thanks.

In looking at the remaining failures, several have to do with
an early clobber if the first incoming argument register.

The issue is that this is where return values are placed, so we run
into a situation where that incoming argument value can't be
reconstituted in any way by the variable tracking code and thus gdb
says that it has been optimized out.

Many non-x86 cpus are going to run into this problem.  For example,
from pr36728-1.c:

foo:
        save    %sp, -96, %sp
        add     %sp, -40, %sp
        mov     2, %g2
        add     %sp, 123, %g1
        mov     25, %g4
        and     %g1, -32, %g1
        sethi   %hi(b), %g3
        st      %g2, [%g1]
        ld      [%fp+92], %g2
        nop
        ld      [%g1], %i0
        add     %g2, 14, %g2
        and     %g2, -8, %g2
        sub     %sp, %g2, %sp
        stb     %g4, [%sp+96]
        add     %sp, 96, %g2
        sethi   %hi(a), %g4
        nop
        return  %i7+8
         nop

Here %i0 is written early, and then the tests can't view 'arg1'
properly later in the function.

Also, I noticed that calculation of the on-stack address of values
with alignment regressed in gcc-4.8 vs. gcc-4.7 Again, in pr36728-1.c,
'y' can be printed properly in gcc-4.7 but in gcc-4.8 it cannot.

I think it might be getting the base register wrong, I'll look
more deeply if I get a chance.



More information about the Gcc-patches mailing list