public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add attribute hot judgement for INLINE_HINT_known_hot hint.
@ 2022-09-20  8:48 Cui,Lili
  2022-09-20 16:17 ` Jan Hubicka
  0 siblings, 1 reply; 9+ messages in thread
From: Cui,Lili @ 2022-09-20  8:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, hongtao.liu, hongjiu.lu

Hi Honza,

This patch is to add attribute hot judgement for INLINE_HINT_known_hot hint.

We set up INLINE_HINT_known_hot hint only when we have profile feedback,
now add function attribute judgement for it, when both caller and callee
have __attribute__((hot)), we will also set up INLINE_HINT_known_hot hint
for it.

With this patch applied
                                 Ratio   Codesize
ADL Multi-copy:    538.imagic_r  16.7%    1.6%
SPR Multi-copy:    538.imagic_r  15%      1.7%
ICX Multi-copy:    538.imagic_r  15.2%    1.7%
CLX Multi-copy:    538.imagic_r  12.7%    1.7%
Znver3 Multi-copy: 538.imagic_r  10.6%    1.5%

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.
OK for trunk?

Thanks,
Lili.

gcc/ChangeLog

  * ipa-inline-analysis.cc (do_estimate_edge_time): Add function attribute
  judgement for INLINE_HINT_known_hot hint.
---
 gcc/ipa-inline-analysis.cc | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/gcc/ipa-inline-analysis.cc b/gcc/ipa-inline-analysis.cc
index 1ca685d1b0e..7bd29c36590 100644
--- a/gcc/ipa-inline-analysis.cc
+++ b/gcc/ipa-inline-analysis.cc
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-utils.h"
 #include "cfgexpand.h"
 #include "gimplify.h"
+#include "attribs.h"
 
 /* Cached node/edge growths.  */
 fast_call_summary<edge_growth_cache_entry *, va_heap> *edge_growth_cache = NULL;
@@ -249,15 +250,19 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
       hints = estimates.hints;
     }
 
-  /* When we have profile feedback, we can quite safely identify hot
-     edges and for those we disable size limits.  Don't do that when
-     probability that caller will call the callee is low however, since it
+  /* When we have profile feedback or function attribute, we can quite safely
+     identify hot edges and for those we disable size limits.  Don't do that
+     when probability that caller will call the callee is low however, since it
      may hurt optimization of the caller's hot path.  */
-  if (edge->count.ipa ().initialized_p () && edge->maybe_hot_p ()
+  if ((edge->count.ipa ().initialized_p () && edge->maybe_hot_p ()
       && (edge->count.ipa () * 2
 	  > (edge->caller->inlined_to
 	     ? edge->caller->inlined_to->count.ipa ()
 	     : edge->caller->count.ipa ())))
+      || (lookup_attribute ("hot", DECL_ATTRIBUTES (edge->caller->decl))
+	  != NULL
+	 && lookup_attribute ("hot", DECL_ATTRIBUTES (edge->callee->decl))
+	  != NULL))
     hints |= INLINE_HINT_known_hot;
 
   gcc_checking_assert (size >= 0);
-- 
2.17.1


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

end of thread, other threads:[~2022-10-31 16:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20  8:48 [PATCH] Add attribute hot judgement for INLINE_HINT_known_hot hint Cui,Lili
2022-09-20 16:17 ` Jan Hubicka
2022-09-21  9:21   ` Cui, Lili
2022-10-08  0:33     ` Ping^1 " Cui, Lili
2022-10-14  6:28       ` Ping^2 " Cui, Lili
2022-10-21  1:52         ` Ping^3 [PATCH V2] " Cui, Lili
2022-10-29  4:28           ` Jeff Law
2022-10-31  1:44             ` Cui, Lili
2022-10-31 16:35               ` Jeff Law

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