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]

Better -Winline


Hi,
in the kernel htere is actually occurence of function that is not
inlined because extern inline function is overwriten by different body
and we concluded that it is better to not inline than randomly choose
one of two bodies.
The reason given is "function not considered for inlinining" that is
right, but not very informative.  Fixed thus.

Plan to fix this after testing unless someone points out grammar error
in message.

	* cgraph.h (cgraph_local_info):  Add local.redefined_extern_inline.
	* cgraph.c (create_edge):  Set use local.redefined_extern_inline
	* cgraphunit.c (cgraph_analyze_function): Likewise.
	(cgraph_finalize_function): set it.
Index: cgraph.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 cgraph.c
*** cgraph.c	4 Jan 2004 14:39:12 -0000	1.40
--- cgraph.c	13 Jan 2004 21:43:50 -0000
*************** create_edge (struct cgraph_node *caller,
*** 159,164 ****
--- 159,167 ----
  
    if (!DECL_SAVED_TREE (callee->decl))
      edge->inline_failed = N_("function body not available");
+   else if (callee->local.redefined_extern_inline)
+     edge->inline_failed = N_("redefined extern inline functions are not "
+ 			     "considered for inlining");
    else if (callee->local.inlinable)
      edge->inline_failed = N_("function not considered for inlining");
    else
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 cgraphunit.c
*** cgraphunit.c	8 Jan 2004 22:57:49 -0000	1.43
--- cgraphunit.c	13 Jan 2004 21:43:53 -0000
*************** cgraph_finalize_function (tree decl, boo
*** 184,189 ****
--- 184,190 ----
        memset (&node->global, 0, sizeof (node->global));
        memset (&node->rtl, 0, sizeof (node->rtl));
        node->analyzed = false;
+       node->local.redefined_extern_inline = true;
        while (node->callees)
  	cgraph_remove_edge (node, node->callees->callee);
  
*************** cgraph_analyze_function (struct cgraph_n
*** 327,334 ****
        = (*lang_hooks.tree_inlining.disregard_inline_limits) (decl);
    for (e = node->callers; e; e = e->next_caller)
      if (e->inline_failed)
!       e->inline_failed = (!node->local.inlinable ? N_("function not inlinable")
! 			  : N_("function not considered for inlining"));
    if (flag_really_no_inline && !node->local.disregard_inline_limits)
      node->local.inlinable = 0;
    /* Inlining characteristics are maintained by the cgraph_mark_inline.  */
--- 328,342 ----
        = (*lang_hooks.tree_inlining.disregard_inline_limits) (decl);
    for (e = node->callers; e; e = e->next_caller)
      if (e->inline_failed)
!       {
! 	if (node->local.redefined_extern_inline)
! 	  e->inline_failed = N_("redefined extern inline functions are not "
! 				"considered for inlining");
! 	else if (!node->local.inlinable)
! 	  e->inline_failed = N_("function not inlinable");
! 	else
! 	  e->inline_failed = N_("function not considered for inlining");
!       }
    if (flag_really_no_inline && !node->local.disregard_inline_limits)
      node->local.inlinable = 0;
    /* Inlining characteristics are maintained by the cgraph_mark_inline.  */
Index: cgraph.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.h,v
retrieving revision 1.25
diff -c -3 -p -r1.25 cgraph.h
*** cgraph.h	4 Jan 2004 14:39:12 -0000	1.25
--- cgraph.h	13 Jan 2004 21:45:30 -0000
*************** struct cgraph_local_info GTY(())
*** 39,44 ****
--- 39,47 ----
    bool disregard_inline_limits;
    /* Size of the function before inlining.  */
    int self_insns;
+   /* True when the function has been originally extern inline, but it is
+      redefined now.  */
+   bool redefined_extern_inline;
  };
  
  /* Information about the function that needs to be computed globally


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