diff mbox series

Restrict IPA split (PR go/63560).

Message ID b3bc3d67-d8ef-1274-2963-aea059c4eef7@suse.cz
State New
Headers show
Series Restrict IPA split (PR go/63560). | expand

Commit Message

Martin Liška March 8, 2019, 11:23 a.m. UTC
Hi.

This is quite old hunk that Honza forgot to install:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63560#c1

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed? Or should I wait for next stage1?

Thanks,
Martin

gcc/ChangeLog:

2019-03-08  Jan Hubicka  <hubicka@ucw.cz>

	PR go/63560
	* ipa-split.c (execute_split_functions): Do not split
	'noinline' or 'section' function.
---
 gcc/ipa-split.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Jan Hubicka March 8, 2019, 12:26 p.m. UTC | #1
> Hi.
> 
> This is quite old hunk that Honza forgot to install:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63560#c1
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> Ready to be installed? Or should I wait for next stage1?
> 
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-03-08  Jan Hubicka  <hubicka@ucw.cz>
> 
> 	PR go/63560
> 	* ipa-split.c (execute_split_functions): Do not split
> 	'noinline' or 'section' function.

It is OK now. It only makes us more conservative and moving code out of
user sections may lead to surprises.

Honza
diff mbox series

Patch

diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index cfd03abb07d..5eaf8257f98 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -104,6 +104,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple-pretty-print.h"
 #include "ipa-fnsummary.h"
 #include "cfgloop.h"
+#include "attribs.h"
 
 /* Per basic block info.  */
 
@@ -1751,6 +1752,20 @@  execute_split_functions (void)
       return 0;
     }
 
+  if (lookup_attribute ("noinline", DECL_ATTRIBUTES (current_function_decl)))
+    {
+      if (dump_file)
+	fprintf (dump_file, "Not splitting: function is noinline.\n");
+      return 0;
+    }
+  if (lookup_attribute ("section", DECL_ATTRIBUTES (current_function_decl)))
+    {
+      if (dump_file)
+	fprintf (dump_file, "Not splitting: function is in user defined "
+		 "section.\n");
+      return 0;
+    }
+
   /* We enforce splitting after loop headers when profile info is not
      available.  */
   if (profile_status_for_fn (cfun) != PROFILE_READ)