]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR target/7044
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Mar 2016 17:24:16 +0000 (17:24 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Mar 2016 17:24:16 +0000 (17:24 +0000)
* config/aarch64/aarch64.c
(aarch64_override_options_after_change_1): 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.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234118 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/pr70044.c [new file with mode: 0644]

index 3486f06dc479562a267cf52d6cd1118647c1ee26..d53c261bb8127f4895fb3498a9983d7204bc54ef 100644 (file)
@@ -1,3 +1,12 @@
+2016-03-10  Nick Clifton  <nickc@redhat.com>
+
+       PR target/7044
+       * config/aarch64/aarch64.c
+       (aarch64_override_options_after_change_1): 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-03-10  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * common/config/aarch64/aarch64-common.c (aarch64_handle_option):
index 51dfe7917967a3df7ed59462dfaa6a3b47e07e77..d536aa0f1a3d313e3219d2a545b842cf6b0c5883 100644 (file)
@@ -8110,10 +8110,25 @@ aarch64_parse_override_string (const char* input_string,
 static void
 aarch64_override_options_after_change_1 (struct gcc_options *opts)
 {
+  /* 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 (opts->x_flag_omit_frame_pointer == 2)
+    opts->x_flag_omit_frame_pointer = 0;
+
   if (opts->x_flag_omit_frame_pointer)
     opts->x_flag_omit_leaf_frame_pointer = false;
   else if (opts->x_flag_omit_leaf_frame_pointer)
-    opts->x_flag_omit_frame_pointer = true;
+    opts->x_flag_omit_frame_pointer = 2;
 
   /* If not optimizing for size, set the default
      alignment to what the target wants.  */
index 3043ab95b2257a3ed4d38dadcb1bbfc5e5f7b237..be04568f5ddda5fdade8c3377ad41263c7ab858f 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-10  Nick Clifton  <nickc@redhat.com>
+
+       PR target/70044
+       * gcc.target/aarch64/pr70044.c: New test.
+
 2016-03-10  Patrick Palka  <ppalka@gcc.gnu.org>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gcc.target/aarch64/pr70044.c b/gcc/testsuite/gcc.target/aarch64/pr70044.c
new file mode 100644 (file)
index 0000000..1a84941
--- /dev/null
@@ -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," } } */