public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Andre Vieira <Andre.SimoesDiasVieira@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][GCC] Make stackalign test LTO proof
Date: Mon, 16 Nov 2015 13:33:00 -0000	[thread overview]
Message-ID: <CAFiYyc2kEj+RbbJ1=0atc6L1vHVNbQwmt5xtLAsgHJ69Tf81-Q@mail.gmail.com> (raw)
In-Reply-To: <5649C158.50903@arm.com>

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
>

  reply	other threads:[~2015-11-16 13:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 15:07 Andre Vieira
2015-11-13 10:34 ` Richard Biener
2015-11-16 11:43   ` Andre Vieira
2015-11-16 13:33     ` Richard Biener [this message]
2015-11-16 14:08       ` Andre Vieira
2015-11-16 14:31         ` Richard Biener
2015-11-16 15:34 Joern Wolfgang Rennecke
2015-11-16 15:48 ` Andre Vieira
2015-11-17 12:29   ` Bernd Schmidt
2015-11-17 16:30     ` Andre Vieira
2015-12-04 15:19       ` Andre Vieira
2015-12-04 17:34         ` Bernd Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc2kEj+RbbJ1=0atc6L1vHVNbQwmt5xtLAsgHJ69Tf81-Q@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=Andre.SimoesDiasVieira@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).