This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/IPA] Fix ipa-polymorphic-call when size of Pmode is not the size of pointers in user code
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 19 Nov 2014 17:37:21 -0800
- Subject: Re: [PATCH/IPA] Fix ipa-polymorphic-call when size of Pmode is not the size of pointers in user code
- Authentication-results: sourceware.org; auth=none
- References: <CA+=Sn1=zo+6_8o-Rg6LEFAod1M-91hpPLfGvhuTvv-f00RJHBA at mail dot gmail dot com> <CAMe9rOo4cceHbfCdO_yTr+3y4Y4nnbXE2apMWRG9yYTmXYAz0w at mail dot gmail dot com> <CA+=Sn1=t1pdonZm+nsOgtwObiDsJjU+d7=N7LKMVKt38T+Nbyw at mail dot gmail dot com> <CAMe9rOrP6JzWn=DtJEeyW1VhTasA5_6Kz-C4MWVkdFKbPQKDfQ at mail dot gmail dot com> <CA+=Sn1ksfSgnHxZyAycMeMCUogOPj3sKLPPqtHXuErpEqqG-=w at mail dot gmail dot com>
On Wed, Nov 19, 2014 at 5:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>> Hi,
>>>>> For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>>>> being SImode while Pmode is DImode and POINTER_SIZE is 32). This
>>>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>>>> for pointers. Right now before this patch we get many testcase
>>>>> failures in the C++ testsuite due to this. Some of the tests fail due
>>>>> to the wrong devirtualization happening (using the base class rather
>>>>> the current class).
>>>>>
>>>>> This patch fixes the issue by using POINTER_SIZE in place of
>>>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>>>
>>>>> OK? Bootstrapped and tested on x86_64 and cross built and tested for
>>>>> aarch64-elf with no regressions.
>>>>>
>>>>> Thanks,
>>>>> Andrew Pinski
>>>>>
>>>>> ChangeLog:
>>>>> ipa/63981
>>>>> * ipa-polymorphic-call.c (possible_placement_new):
>>>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>>>
>>>> Does Pmode affect class layout?
>>>
>>> No only POINTER_SIZE. ILP32 is one of the few ABIs where Pmode !=
>>> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>>>
>>> x32 has a similar issue with -maddress-mode=long but the default for
>>> x32 is -maddress-mode=short.
>>
>> Pmode shouldn't change class layout, which is determined by ptr_mode.
>> You can mix object files compiled by -maddress-mode=long with
>> -maddress-mode=short. Do those tests fail with -maddress-mode=long
>> under x32?
>
>
> I suspect they do fail with -maddress-mode=long but I did not try as I
> don't have x32 testing setup right now.
>
Which one may fail with -maddress-mode=long?
--
H.J.