This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH][GCC] Make stackalign test LTO proof


On Mon, Nov 16, 2015 at 3:08 PM, Andre Vieira
<Andre.SimoesDiasVieira@arm.com> wrote:
> On 16/11/15 13:33, Richard Biener wrote:
>>
>> On Mon, Nov 16, 2015 at 12:43 PM, Andre Vieira
>> <Andre.SimoesDiasVieira@arm.com> wrote:
>>>
>>> On 13/11/15 10:34, Richard Biener wrote:
>>>>
>>>>
>>>> On Thu, Nov 12, 2015 at 4:07 PM, Andre Vieira
>>>> <Andre.SimoesDiasVieira@arm.com> wrote:
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>>     This patch changes this testcase to make sure LTO will not optimize
>>>>> away
>>>>> the assignment of the local array to a global variable which was
>>>>> introduced
>>>>> to make sure stack space was made available for the test to work.
>>>>>
>>>>>     This is correct because LTO is supposed to optimize this global
>>>>> away
>>>>> as at
>>>>> link time it knows this global will never be read. By adding a read of
>>>>> the
>>>>> global, LTO will no longer optimize it away.
>>>>
>>>>
>>>>
>>>> But that's only because we can't see that bar doesn't clobber it, else
>>>> we would optimize away the check and get here again.  Much better
>>>> to mark 'dummy' with __attribute__((used)) and go away with 'g'
>>>> entirely.
>>>>
>>>> Richard.
>>>>
>>>>>     Tested by running regressions for this testcase for various ARM
>>>>> targets.
>>>>>
>>>>>     Is this OK to commit?
>>>>>
>>>>>     Thanks,
>>>>>     Andre Vieira
>>>>>
>>>>> gcc/testsuite/ChangeLog:
>>>>> 2015-11-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>
>>>>>
>>>>>           * gcc.dg/torture/stackalign/builtin-return-1.c: Added read
>>>>>             to global such that a write is not optimized away by LTO.
>>>>
>>>>
>>>>
>>> Hi Richard,
>>>
>>> That would be great but __attribute__ ((used)) can only be used for
>>> static
>>> variables and making dummy static would defeat the purpose here.
>>
>>
>> I see.  What about volatile?
>>
>>> Cheers,
>>> Andre
>>>
>>
> Yeh a 'volatile char dummy[64];' with a read afterwards leads to the stack
> still being reserved after LTO and we won't need the global variable.
>
> If you prefer that solution Ill respin the patch.

Yes please.

Richard.

> Cheers,
> Andre
>


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