public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Richard Biener <rguenther@suse.de>
Subject: [PATCH] strub: use opt_for_fn during ipa
Date: Thu, 14 Dec 2023 16:54:08 -0300	[thread overview]
Message-ID: <oro7es36hr.fsf@lxoliva.fsfla.org> (raw)


Instead of global optimization levels and flags, check per-function
ones.

Regstrapped on x86_64-linux-gnu, also testing on sparc-solaris2.11.3.
Ok to install?

(sorry, Richi, I dropped the ball and failed to fix this before the
monster commit)


for  gcc/ChangeLog

	* ipa-strub.cc (gsi_insert_finally_seq_after_call): Likewise.
	(pass_ipa_strub::adjust_at_calls_call): Likewise.
---
 gcc/ipa-strub.cc |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 943bb60996fc1..32e2869cf7840 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -2132,7 +2132,7 @@ gsi_insert_finally_seq_after_call (gimple_stmt_iterator gsi, gimple_seq seq)
 		    || (call && gimple_call_nothrow_p (call))
 		    || (eh_lp <= 0
 			&& (TREE_NOTHROW (cfun->decl)
-			    || !flag_exceptions)));
+			    || !opt_for_fn (cfun->decl, flag_exceptions))));
 
   if (noreturn_p && nothrow_p)
     return;
@@ -2470,9 +2470,11 @@ pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
   /* If we're already within a strub context, pass on the incoming watermark
      pointer, and omit the enter and leave calls around the modified call, as an
      optimization, or as a means to satisfy a tail-call requirement.  */
-  tree swmp = ((optimize_size || optimize > 2
+  tree swmp = ((opt_for_fn (e->caller->decl, optimize_size)
+		|| opt_for_fn (e->caller->decl, optimize) > 2
 		|| gimple_call_must_tail_p (ocall)
-		|| (optimize == 2 && gimple_call_tail_p (ocall)))
+		|| (opt_for_fn (e->caller->decl, optimize) == 2
+		    && gimple_call_tail_p (ocall)))
 	       ? strub_watermark_parm (e->caller->decl)
 	       : NULL_TREE);
   bool omit_own_watermark = swmp;

-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

             reply	other threads:[~2023-12-14 19:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 19:54 Alexandre Oliva [this message]
2023-12-15  7:08 ` Richard Biener
2023-12-19  3:54   ` Alexandre Oliva
2023-12-19  8:20     ` Richard Biener

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=oro7es36hr.fsf@lxoliva.fsfla.org \
    --to=oliva@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).