public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Don't export function bodies marked go:noinline
@ 2019-07-20  3:18 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2019-07-20  3:18 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

This Go frontend patch by Than McIntosh stops exporting bodies for
functions marked "go:noinline".  The current Mark_inline_candidates
helper looks only at budget when deciding to mark a function or method
as inline (with the proviso that IR constructs not yet supported by
the inliner are given artificially high cost).  This patch changes the
helper to also look at whether a function has the "go:noinline"
pragma; if it does have the pragma there is no point putting it into
the export data (it will just make the export data bigger).
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1267 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 273577)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-4df7c8d7af894ee93f50c3a50debdcf4e369a2c6
+e242929304e7a524ced56dc94605bbf6d83e6489
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/gogo.cc
===================================================================
--- gcc/go/gofrontend/gogo.cc	(revision 273564)
+++ gcc/go/gofrontend/gogo.cc	(working copy)
@@ -5109,6 +5109,8 @@ int
 Mark_inline_candidates::function(Named_object* no)
 {
   Function* func = no->func_value();
+  if ((func->pragmas() & GOPRAGMA_NOINLINE) != 0)
+    return TRAVERSE_CONTINUE;
   int budget = budget_heuristic;
   Inline_within_budget iwb(&budget);
   func->block()->traverse(&iwb);
@@ -5138,6 +5140,8 @@ Mark_inline_candidates::type(Type* t)
       Named_object* no = *p;
       go_assert(no->is_function());
       Function *func = no->func_value();
+      if ((func->pragmas() & GOPRAGMA_NOINLINE) != 0)
+        continue;
       int budget = budget_heuristic;
       Inline_within_budget iwb(&budget);
       func->block()->traverse(&iwb);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-19 23:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-20  3:18 Go patch committed: Don't export function bodies marked go:noinline Ian Lance Taylor

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