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 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.


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