public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Biener <richard.guenther@gmail.com>,
	Richard Sandiford <richard.sandiford@arm.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Peter Bergner <bergner@linux.ibm.com>
Subject: Re: PING^1 [PATCH v2] predict: Adjust optimize_function_for_size_p [PR105818]
Date: Wed, 14 Dec 2022 14:22:16 +0100	[thread overview]
Message-ID: <Y5nOCM5gxRVOEexX@kam.mff.cuni.cz> (raw)
In-Reply-To: <64451523-8036-6d9a-b990-e07746867efd@linux.ibm.com>

> > 	PR middle-end/105818
> > 
> > gcc/ChangeLog:
> > 
> > 	* predict.cc (optimize_function_for_size_p): Further check
> > 	optimize_size of fun->decl when it is valid but no cgraph node.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> > 	* gcc.target/powerpc/pr105818.c: New test.
> > 	* gcc.dg/guality/pr54693-2.c: Adjust for aarch64.
> > diff --git a/gcc/testsuite/gcc.target/powerpc/pr105818.c b/gcc/testsuite/gcc.target/powerpc/pr105818.c
> > new file mode 100644
> > index 00000000000..679647e189d
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/powerpc/pr105818.c
> > @@ -0,0 +1,11 @@
> > +/* { dg-options "-Os -fno-tree-vectorize" } */
> > +
> > +/* Verify there is no ICE.  */
> > +
> > +#pragma GCC optimize "-fno-tree-vectorize"
> > +
> > +void
> > +foo (void)
> > +{
> > +  void bar (void);
> > +}
So the testcase starts with optimize_size set but then it switches to
optimize_size==0 due to the GCC optimize pragma.  I think this is
behaviour Martin wants to change, so perhaps the testcase should be
written with explicit -O2.

I also wonder what happen when you add the attribute later?
/* { dg-options "-Os -fno-tree-vectorize" } */

/* Verify there is no ICE.  */

#pragma GCC optimize "-fno-tree-vectorize"

void
foo (void)
{
  void bar (void);
}

__attribute__ ((optimize("-fno-tree-vectorize"))) void foo (void);

I think we should generally avoid doing decisions about size/speed
optimizations so early since the setting may change due to attribtes or
profile feedback...

Honza

  reply	other threads:[~2022-12-14 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30  8:30 Kewen.Lin
2022-12-14 11:27 ` PING^1 " Kewen.Lin
2022-12-14 13:22   ` Jan Hubicka [this message]
2022-12-14 13:55     ` Martin Liška
2022-12-15  8:33     ` 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=Y5nOCM5gxRVOEexX@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.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).