From: "Kewen.Lin" <linkw@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
David Edelsohn <dje.gcc@gmail.com>,
Peter Bergner <bergner@linux.ibm.com>,
Michael Meissner <meissner@linux.ibm.com>
Subject: [PATCH/RFC] rs6000: Remove optimize_for_speed check for implicit TARGET_SAVE_TOC_INDIRECT [PR108184]
Date: Mon, 16 Jan 2023 17:39:04 +0800 [thread overview]
Message-ID: <6305f0e5-d235-8916-6d42-7110cfede236@linux.ibm.com> (raw)
In-Reply-To: <d9230de2-d3d3-c960-f39a-4f81b6a094bc@linux.ibm.com>
Hi,
Now we will check optimize_function_for_speed_p (cfun) for
TARGET_SAVE_TOC_INDIRECT if it's implicitly enabled. But
the effect of -msave-toc-indirect is actually to save the
TOC in the prologue for indirect calls rather than inline,
it's also good for optimize_function_for_size? So this
patch is to remove the check of optimize_function_for_speed
and make it work for both optimizing for size and speed.
Bootstrapped and regtested on powerpc64-linux-gnu P8,
powerpc64le-linux-gnu P{9,10} and powerpc-ibm-aix.
Any thoughts?
Thanks in advance!
Kewen
-----
gcc/ChangeLog:
* config/rs6000/rs6000.cc (rs6000_call_aix): Remove the check of
optimize_function_for_speed_p for implicit SAVE_TOC_INDIRECT.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr108184-3.c: Adjust.
---
gcc/config/rs6000/rs6000.cc | 5 +----
gcc/testsuite/gcc.target/powerpc/pr108184-3.c | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index f47d21980a9..870525347d5 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -25688,10 +25688,7 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx tlsarg, rtx cookie)
/* Can we optimize saving the TOC in the prologue or
do we need to do it at every call? */
- if (TARGET_SAVE_TOC_INDIRECT
- && !cfun->calls_alloca
- && (rs6000_isa_flags_explicit & OPTION_MASK_SAVE_TOC_INDIRECT
- || optimize_function_for_speed_p (cfun)))
+ if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca)
cfun->machine->save_toc_in_prologue = true;
else
{
diff --git a/gcc/testsuite/gcc.target/powerpc/pr108184-3.c b/gcc/testsuite/gcc.target/powerpc/pr108184-3.c
index ceaa96e4421..a1ce3a18855 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr108184-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr108184-3.c
@@ -2,15 +2,22 @@
/* { dg-require-effective-target fpic } */
/* { dg-options "-fpic -mno-pcrel -O2" } */
-/* Verify it doesn't imply -msave-toc-indirect, so
- it doesn't take effect and we have two separated
- toc savings for these two long calls. */
+/* Verify -msave-toc-indirect is implicitly enabled
+ for both optimizing for speed and size, so one
+ toc saving for each function. */
void foo (void) __attribute__((__longcall__));
int baz (void) __attribute__((__longcall__));
-__attribute__ ((cold)) int
-bar (void)
+__attribute__ ((cold, noipa)) int
+bar1 (void)
+{
+ foo ();
+ return baz () + 1;
+}
+
+__attribute__ ((noipa)) int
+bar2 (void)
{
foo ();
return baz () + 1;
--
2.27.0
next prev parent reply other threads:[~2023-01-16 9:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 9:08 [PATCH v2] rs6000: Don't use optimize_function_for_speed_p too early [PR108184] Kewen.Lin
2023-01-16 9:39 ` Kewen.Lin [this message]
2023-01-17 20:57 ` [PATCH/RFC] rs6000: Remove optimize_for_speed check for implicit TARGET_SAVE_TOC_INDIRECT [PR108184] Michael Meissner
2023-01-17 20:58 ` Michael Meissner
2023-01-18 9:04 ` Kewen.Lin
2023-06-15 6:41 ` PING^1 [PATCH v2] rs6000: Don't use optimize_function_for_speed_p too early [PR108184] Kewen.Lin
2023-08-07 10:06 ` PING^2 " Kewen.Lin
2023-10-25 2:48 ` PING^3 " Kewen.Lin
2023-11-08 2:51 ` PING^4 " Kewen.Lin
2023-12-04 9:57 ` PING^5 " Kewen.Lin
2023-12-12 6:09 ` PING^6 " Kewen.Lin
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=6305f0e5-d235-8916-6d42-7110cfede236@linux.ibm.com \
--to=linkw@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=meissner@linux.ibm.com \
--cc=segher@kernel.crashing.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).