changeset 122:fb3d53c41846

do not expand code segment
author mir3636
date Thu, 22 Mar 2018 17:37:58 +0900
parents 49957f95a4d1
children ab229f40eab2
files gcc/ipa-inline.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gcc/ipa-inline.c	Fri Mar 09 19:18:14 2018 +0900
+++ b/gcc/ipa-inline.c	Thu Mar 22 17:37:58 2018 +0900
@@ -120,6 +120,7 @@
 #include "stringpool.h"
 #include "attribs.h"
 #include "asan.h"
+#include "c/cbc-tree.h"
 
 typedef fibonacci_heap <sreal, cgraph_edge> edge_heap_t;
 typedef fibonacci_node <sreal, cgraph_edge> edge_heap_node_t;
@@ -2203,6 +2204,16 @@
 		   node->callers->caller->name (),
 		   ipa_fn_summaries->get (node->callers->caller)->size);
 	}
+#ifndef noCbC
+      /* tail call flag is not valid when a code segment is inlined in a normal function.
+         do not expand the call. */
+      tree from = caller->decl;
+      if (node->callees && node->callees->callee) {
+        tree to   = node->callees->callee->decl;
+        if (CbC_IS_CODE_SEGMENT (TREE_TYPE (to)) && !CbC_IS_CODE_SEGMENT (TREE_TYPE (from)))
+          continue;
+      }
+#endif
 
       /* Remember which callers we inlined to, delaying updating the
 	 overall summary.  */