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]

PR middle-end/28779 (inliner ICE)


Hi,
the problem in the testcase is that one TU use implicit declaration of the function
and we do estimate function call expenses based on it, while other TU define with
slightly different prototype leading to different call costs.

For a while I intended to move code estimating size of function to the inliner
itself and this seems good motivation to do so.  For a moment I introduced
little hack to not recompute the sizes after early inlining to avoid slowing
down 4.2.  After IPA branch merge, this will go away as early optimization
change bodies.

Bootstrapped/regtested i686-linux and commited.
Did we gainded some framwork for IMA testcases already?

	PR middle-end/28779
	* ipa-inline.c (cgraph_decide_inlining, cgraph_early_inlining): Compute
	function body sizes.
	* cgraphunit.c (cgraph_analyze_function): Don't do so.
Index: ipa-inline.c
===================================================================
*** ipa-inline.c	(revision 116257)
--- ipa-inline.c	(working copy)
*************** cgraph_decide_inlining (void)
*** 899,911 ****
    timevar_push (TV_INLINE_HEURISTICS);
    max_count = 0;
    for (node = cgraph_nodes; node; node = node->next)
!     {
!       struct cgraph_edge *e;
!       initial_insns += node->local.self_insns;
!       for (e = node->callees; e; e = e->next_callee)
! 	if (max_count < e->count)
! 	  max_count = e->count;
!     }
    overall_insns = initial_insns;
    gcc_assert (!max_count || (profile_info && flag_branch_probabilities));
  
--- 899,921 ----
    timevar_push (TV_INLINE_HEURISTICS);
    max_count = 0;
    for (node = cgraph_nodes; node; node = node->next)
!     if (node->analyzed && (node->needed || node->reachable))
!       {
! 	struct cgraph_edge *e;
! 
! 	/* At the moment, no IPA passes change function bodies before inlining.
! 	   Save some time by not recomputing function body sizes if early inlining
! 	   already did so.  */
! 	if (!flag_early_inlining)
! 	  node->local.self_insns = node->global.insns
! 	     = estimate_num_insns (node->decl);
! 
! 	initial_insns += node->local.self_insns;
! 	gcc_assert (node->local.self_insns == node->global.insns);
! 	for (e = node->callees; e; e = e->next_callee)
! 	  if (max_count < e->count)
! 	    max_count = e->count;
!       }
    overall_insns = initial_insns;
    gcc_assert (!max_count || (profile_info && flag_branch_probabilities));
  
*************** cgraph_early_inlining (void)
*** 1180,1185 ****
--- 1190,1202 ----
    for (i = nnodes - 1; i >= 0; i--)
      {
        node = order[i];
+       if (node->analyzed && (node->needed || node->reachable))
+         node->local.self_insns = node->global.insns
+ 	  = estimate_num_insns (node->decl);
+     }
+   for (i = nnodes - 1; i >= 0; i--)
+     {
+       node = order[i];
        if (node->analyzed && node->local.inlinable
  	  && (node->needed || node->reachable)
  	  && node->callers)
Index: cgraphunit.c
===================================================================
*** cgraphunit.c	(revision 116257)
--- cgraphunit.c	(working copy)
*************** cgraph_analyze_function (struct cgraph_n
*** 928,934 ****
    cgraph_create_edges (node, decl);
  
    node->local.inlinable = tree_inlinable_function_p (decl);
!   node->local.self_insns = estimate_num_insns (decl);
    if (node->local.inlinable)
      node->local.disregard_inline_limits
        = lang_hooks.tree_inlining.disregard_inline_limits (decl);
--- 928,935 ----
    cgraph_create_edges (node, decl);
  
    node->local.inlinable = tree_inlinable_function_p (decl);
!   if (!flag_unit_at_a_time)
!     node->local.self_insns = estimate_num_insns (decl);
    if (node->local.inlinable)
      node->local.disregard_inline_limits
        = lang_hooks.tree_inlining.disregard_inline_limits (decl);


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