public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][AArch64] Backport of PR 70044 fix to GCC 5
@ 2016-04-04  9:10 Kyrill Tkachov
  2016-04-14 13:25 ` Kyrill Tkachov
  0 siblings, 1 reply; 3+ messages in thread
From: Kyrill Tkachov @ 2016-04-04  9:10 UTC (permalink / raw)
  To: GCC Patches
  Cc: Nick Clifton, Marcus Shawcroft, Richard Earnshaw, James Greenhalgh

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

Hi all,

I'd like to backport Nicks' patch for PR 70044 to the GCC 5 branch.
The patch doesn't apply cleanly because the aarch64_override_options_after_change and
associated machinery was reworked for GCC 6. This is the (simple) backport of that
patch to GCC 5.

Bootstrapped and tested on aarch64-none-linux-gnu. Confirmed that the test fails before the patch
and passes with it.

Ok to commit?

Thanks,
Kyrill

2016-04-04  Nick Clifton  <nickc@redhat.com>
             Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR target/70044
     * config/aarch64/aarch64.c
     (aarch64_override_options_after_change): When forcing
     flag_omit_frame_pointer to be true, use a special value that can
     be detected if this function is called again, thus preventing
     flag_omit_leaf_frame_pointer from being forced to be false.

2016-04-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     Backport from mainline
     2016-03-31  Nick Clifton  <nickc@redhat.com>

     PR target/70044
     * gcc.target/aarch64/pr70044.c: New test.

[-- Attachment #2: aarch64-fomit-lto.patch --]
[-- Type: text/x-patch, Size: 2152 bytes --]

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 5c7291e535d756afd977894afa9c2bc53f5d8656..4113609d470ff21de47a647217fd20be4c967225 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6917,10 +6917,26 @@ aarch64_override_options (void)
 static void
 aarch64_override_options_after_change (void)
 {
+  /* The logic here is that if we are disabling all frame pointer generation
+     then we do not need to disable leaf frame pointer generation as a
+     separate operation.  But if we are *only* disabling leaf frame pointer
+     generation then we set flag_omit_frame_pointer to true, but in
+     aarch64_frame_pointer_required we return false only for leaf functions.
+
+     PR 70044: We have to be careful about being called multiple times for the
+     same function.  Once we have decided to set flag_omit_frame_pointer just
+     so that we can omit leaf frame pointers, we must then not interpret a
+     second call as meaning that all frame pointer generation should be
+     omitted.  We do this by setting flag_omit_frame_pointer to a special,
+     non-zero value.  */
+
+  if (flag_omit_frame_pointer == 2)
+    flag_omit_frame_pointer = 0;
+
   if (flag_omit_frame_pointer)
     flag_omit_leaf_frame_pointer = false;
   else if (flag_omit_leaf_frame_pointer)
-    flag_omit_frame_pointer = true;
+    flag_omit_frame_pointer = 2;
 
   /* If not optimizing for size, set the default
      alignment to what the target wants */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr70044.c b/gcc/testsuite/gcc.target/aarch64/pr70044.c
new file mode 100644
index 0000000000000000000000000000000000000000..1a84941dd7ea9dc366dd0ba51e0a96fcb312048f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr70044.c
@@ -0,0 +1,14 @@
+/* { dg-do link } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-flto -O --save-temps -fno-omit-frame-pointer" } */
+
+extern int atoi (const char *);
+
+int
+main (int argc, char **argv)
+{
+  return atoi (argv[0]) + 1;
+}
+
+/* Check that the frame pointer really is created.  */
+/* { dg-final { scan-lto-assembler "add	x29, sp," } } */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][AArch64] Backport of PR 70044 fix to GCC 5
  2016-04-04  9:10 [PATCH][AArch64] Backport of PR 70044 fix to GCC 5 Kyrill Tkachov
@ 2016-04-14 13:25 ` Kyrill Tkachov
  2016-04-14 13:36   ` James Greenhalgh
  0 siblings, 1 reply; 3+ messages in thread
From: Kyrill Tkachov @ 2016-04-14 13:25 UTC (permalink / raw)
  To: GCC Patches
  Cc: Nick Clifton, Marcus Shawcroft, Richard Earnshaw, James Greenhalgh

Ping.
https://gcc.gnu.org/ml/gcc-patches/2016-04/msg00142.html

Thanks,
Kyrill
On 04/04/16 10:10, Kyrill Tkachov wrote:
> Hi all,
>
> I'd like to backport Nicks' patch for PR 70044 to the GCC 5 branch.
> The patch doesn't apply cleanly because the aarch64_override_options_after_change and
> associated machinery was reworked for GCC 6. This is the (simple) backport of that
> patch to GCC 5.
>
> Bootstrapped and tested on aarch64-none-linux-gnu. Confirmed that the test fails before the patch
> and passes with it.
>
> Ok to commit?
>
> Thanks,
> Kyrill
>
> 2016-04-04  Nick Clifton  <nickc@redhat.com>
>             Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     PR target/70044
>     * config/aarch64/aarch64.c
>     (aarch64_override_options_after_change): When forcing
>     flag_omit_frame_pointer to be true, use a special value that can
>     be detected if this function is called again, thus preventing
>     flag_omit_leaf_frame_pointer from being forced to be false.
>
> 2016-04-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     Backport from mainline
>     2016-03-31  Nick Clifton  <nickc@redhat.com>
>
>     PR target/70044
>     * gcc.target/aarch64/pr70044.c: New test.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][AArch64] Backport of PR 70044 fix to GCC 5
  2016-04-14 13:25 ` Kyrill Tkachov
@ 2016-04-14 13:36   ` James Greenhalgh
  0 siblings, 0 replies; 3+ messages in thread
From: James Greenhalgh @ 2016-04-14 13:36 UTC (permalink / raw)
  To: Kyrill Tkachov
  Cc: GCC Patches, Nick Clifton, Marcus Shawcroft, Richard Earnshaw

On Thu, Apr 14, 2016 at 02:24:48PM +0100, Kyrill Tkachov wrote:
> Ping.
> https://gcc.gnu.org/ml/gcc-patches/2016-04/msg00142.html
> 
> Thanks,
> Kyrill
> On 04/04/16 10:10, Kyrill Tkachov wrote:
> >Hi all,
> >
> >I'd like to backport Nicks' patch for PR 70044 to the GCC 5 branch.
> >The patch doesn't apply cleanly because the aarch64_override_options_after_change and
> >associated machinery was reworked for GCC 6. This is the (simple) backport of that
> >patch to GCC 5.
> >
> >Bootstrapped and tested on aarch64-none-linux-gnu. Confirmed that the test fails before the patch
> >and passes with it.
> >
> >Ok to commit?

OK.

Thanks,
James

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-14 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04  9:10 [PATCH][AArch64] Backport of PR 70044 fix to GCC 5 Kyrill Tkachov
2016-04-14 13:25 ` Kyrill Tkachov
2016-04-14 13:36   ` James Greenhalgh

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