This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Work harder to find DECL_STRUCT_FUNCTION


Hi,

you can have chains of clone functions in the callgraph but can_inline_edge_p 
stops at the first clone when it is looking for DECL_STRUCT_FUNCTION, which 
can fool the following conditions in the predicate.

Tested on x86_64-suse-linux, OK for the mainline?


2014-10-06  Eric Botcazou  <ebotcazou@adacore.com>

	* ipa-inline.c (can_inline_edge_p): Recurse on clones to find the
	DECL_STRUCT_FUNCTION of the original node.


-- 
Eric Botcazou
Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 215843)
+++ ipa-inline.c	(working copy)
@@ -276,12 +276,24 @@ can_inline_edge_p (struct cgraph_edge *e
   struct function *caller_cfun = DECL_STRUCT_FUNCTION (e->caller->decl);
   struct function *callee_cfun
     = callee ? DECL_STRUCT_FUNCTION (callee->decl) : NULL;
+  struct cgraph_node *n;
 
-  if (!caller_cfun && e->caller->clone_of)
-    caller_cfun = DECL_STRUCT_FUNCTION (e->caller->clone_of->decl);
+  n = e->caller;
+  while (!caller_cfun && n->clone_of)
+    {
+      n = n->clone_of;
+      caller_cfun = DECL_STRUCT_FUNCTION (n->decl);
+    }
 
-  if (!callee_cfun && callee && callee->clone_of)
-    callee_cfun = DECL_STRUCT_FUNCTION (callee->clone_of->decl);
+  if (callee)
+    {
+      n = callee;
+      while (!callee_cfun && n->clone_of)
+	{
+	  n = n->clone_of;
+	  callee_cfun = DECL_STRUCT_FUNCTION (n->decl);
+	}
+    }
 
   gcc_assert (e->inline_failed);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]