This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcse basic block analysis optimizes EH return stub away (was: Re: Testsuite Results for gcc-2.96 19990628)


On Jul  1, 1999, Jeffrey A Law <law@cygnus.com> wrote:

>> Nope, that's not the cause for the EH problems.  I've been getting
>> them with just `-O9 -g' on all platforms I test for quite a long
>> time.

> I didn't say it was the cause of the EH problems.  But is will cause
> problems with libio & libstdc++.

Ok.  I found a simple testcase that is miscompiled with -O3:

void test(void *eh, long offset, void *handler) {
  __builtin_eh_return (eh, offset, handler);
}

With -O2, it generates code like this:

test:   
        pushl %ebp
        movl %esp,%ebp
        movl 8(%ebp),%eax
        movl 12(%ebp),%ecx
        movl 16(%ebp),%edx
        movl $.L3,4(%ebp)
        jmp .L7
        .p2align 4,,7
.L3:
        jmp *%edx
        .p2align 4,,7
.L7:
        movl %ebp,%esp
        popl %ebp
        ret

But with -O3, it optimizes away the trampoline:

test:
        pushl %ebp
        movl %esp,%ebp
        movl 8(%ebp),%eax
        movl 12(%ebp),%ecx
        movl 16(%ebp),%edx
        movl $.L7,4(%ebp)
.L7:
        movl %ebp,%esp
        popl %ebp
        ret

The dumps up to .addressof are exactly equal; the first one that's
different is .gcse: it claims there are only 2 basic blocks, whereas
with -O2 there are 3, and the indirect_jump block has been wiped out
from the gcse RTL dump with -O3.  Any ideas?

It would be easy to work around the problem by forcing libgcc2.c
-DL_eh to be compiled with -O2, but it would be nicer to try to fix
the problem.  Does anybody have any clue about how to arrange that the
stub is not considered dead?

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]