[Bug ipa/66616] [4.9/5/6 regression] fipa-cp-clone ignores thunk
jamborm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 16 16:06:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66616
--- Comment #16 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #13)
> I got
>
> FAIL: g++.dg/ipa/pr66616.C -std=gnu++11 execution test
> FAIL: g++.dg/ipa/pr66616.C -std=gnu++14 execution test
> FAIL: g++.dg/ipa/pr66616.C -std=gnu++98 execution test
>
> on trunk/x86-64.
Ugh, it seems that with -m32, the clone and its artificial thunks use
a different calling convention than their caller.
With -fno-ipa-cp -fno-inline, the generated assembly for the original
thunk is:
_ZThn12_N1B3fooEi:
.LFB20:
.cfi_startproc
subl $12, 4(%esp)
jmp .LTHUNK0
.cfi_endproc
and the method that IPA-CP would choose to clone also accesses
arguments on the stack.
Whereas with only -fno-inline, the generated assembly for the method
and its artificial thunk is:
_ZN1B3fooEi.constprop.1:
.LFB20:
.cfi_startproc
movl 16(%eax), %eax
movl %eax, _ZL2go
ret
_ZThn12_N1B3fooEi.artificial_thunk.2:
.LFB23:
.cfi_startproc
subl $12, %eax
jmp _ZN1B3fooEi.constprop.1
But in both cases, the caller of the thunk (main), attempts to pass
the argument on the stack.
Honza, do you know how is the calling convention determined at the
caller side? Do we need to change something in gimple for expansion
to take a hint?
More information about the Gcc-bugs
mailing list