[PATCH][PR66010] Don't take address of ap unless necessary

Tom de Vries Tom_deVries@mentor.com
Tue May 12 10:40:00 GMT 2015


On 12-05-15 12:12, Michael Matz wrote:
> Hi,
>
> On Fri, 8 May 2015, Tom de Vries wrote:
>
>> III.
>>
>> Using the patch, before inlining we can see the address operator has been
>> removed in va_arg:
>> ...
>> f2_1 (struct  * apD.1832)
>> {
>>    intD.6 _4;
>>
>>    # .MEM_3 = VDEF <.MEM_1(D)>
>>    # USE = anything
>>    # CLB = anything
>>
>>    _4 = VA_ARG (ap_2(D), 0B, 0);
>>    # VUSE <.MEM_3>
>>    return _4;
>> }
>
> Have you visually inspected that the address operator stays on
> architectures where va_list is e.g. a char pointer

x86_64 -m32:
...
f2 (int i)
{
   charD.2 * ap.0D.1811;
   intD.1 D.1812;
   intD.1 resD.1808;
   charD.2 * apD.1809;

   try
     {
       # USE = anything
       # CLB = anything
       __builtin_va_startD.1021 (&apD.1809, 0);
       ap.0D.1811 = apD.1809;
       # USE = anything
       # CLB = anything
       resD.1808 = f2_1D.1803 (ap.0D.1811);
       # USE = anything
       # CLB = anything
       __builtin_va_endD.1020 (&apD.1809);
       D.1812 = resD.1808;
       return D.1812;
     }
   finally
     {
       apD.1809 = {CLOBBER};
     }
}

f2_1 (char * ap)
{
   intD.1 D.1815;

   # USE = anything
   # CLB = anything
   D.1815 = VA_ARG (&apD.1802, 0B, 1);
   return D.1815;
}
...

Thanks,
- Tom

> (i.e. on those where
> VA_ARG has the side-effect of modifying ap)?



More information about the Gcc-patches mailing list