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]

Avoid WHOPR ICEs in indirect inling


Hi,
whopr now ice on indirect inlining.  This is because of hackdisabling all but
inliner at wpa stage.  For time being I am disabling the indirect inlining at
wpa (at the moment it does not happen with WPA nor LTO since we do not stream
indirect call summary) and we can re-enable it once WPA is fixed and works with
ipa-cp and other passes.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

	* ipa-cp.c (ipcp_read_summary): Remove now invalid FIXME and
	flag_ltrans check.
	* ipa-inline.c (cgraph_mark_inline_edge,
	cgraph_decide_inlining_of_small_function,
	cgraph_decide_inlining, inline_read_summary): Disable indirect inlining
	for WPA for time being.

Index: ipa-cp.c
===================================================================
*** ipa-cp.c	(revision 153449)
--- ipa-cp.c	(working copy)
*************** ipcp_read_summary (void)
*** 1302,1314 ****
  static bool
  cgraph_gate_cp (void)
  {
!   /* FIXME lto.  IPA-CP does not tolerate running when the inlining decisions
!      have not been applied.  This happens when WPA modifies the callgraph.
!      Since those decisions are not applied until after all the IPA passes
!      have been run in LTRANS, this means that IPA passes may see partially
!      modified callgraphs.  The solution to this is to apply WPA decisions
!      early during LTRANS.  */
!   return flag_ipa_cp && !flag_ltrans;
  }
  
  struct ipa_opt_pass_d pass_ipa_cp =
--- 1302,1308 ----
  static bool
  cgraph_gate_cp (void)
  {
!   return flag_ipa_cp;
  }
  
  struct ipa_opt_pass_d pass_ipa_cp =
Index: ipa-inline.c
===================================================================
*** ipa-inline.c	(revision 153449)
--- ipa-inline.c	(working copy)
*************** cgraph_mark_inline_edge (struct cgraph_e
*** 310,316 ****
      overall_size -= orig_size;
    ncalls_inlined++;
  
!   if (flag_indirect_inlining)
      return ipa_propagate_indirect_call_infos (curr, new_edges);
    else
      return false;
--- 310,316 ----
      overall_size -= orig_size;
    ncalls_inlined++;
  
!   if (flag_indirect_inlining && !flag_wpa)
      return ipa_propagate_indirect_call_infos (curr, new_edges);
    else
      return false;
*************** cgraph_decide_inlining_of_small_function
*** 876,882 ****
    int min_size, max_size;
    VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL;
  
!   if (flag_indirect_inlining)
      new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8);
  
    if (dump_file)
--- 876,882 ----
    int min_size, max_size;
    VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL;
  
!   if (flag_indirect_inlining && !flag_wpa)
      new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8);
  
    if (dump_file)
*************** cgraph_decide_inlining_of_small_function
*** 1023,1032 ****
  	  if (where->global.inlined_to)
  	    where = where->global.inlined_to;
  	  if (!cgraph_decide_recursive_inlining (where,
! 						 flag_indirect_inlining
  						 ? &new_indirect_edges : NULL))
  	    continue;
! 	  if (flag_indirect_inlining)
  	    add_new_edges_to_heap (heap, new_indirect_edges);
            update_callee_keys (heap, where, updated_nodes);
  	}
--- 1023,1032 ----
  	  if (where->global.inlined_to)
  	    where = where->global.inlined_to;
  	  if (!cgraph_decide_recursive_inlining (where,
! 						 flag_indirect_inlining && !flag_wpa
  						 ? &new_indirect_edges : NULL))
  	    continue;
! 	  if (flag_indirect_inlining && !flag_wpa)
  	    add_new_edges_to_heap (heap, new_indirect_edges);
            update_callee_keys (heap, where, updated_nodes);
  	}
*************** cgraph_decide_inlining_of_small_function
*** 1045,1051 ****
  	    }
  	  callee = edge->callee;
  	  cgraph_mark_inline_edge (edge, true, &new_indirect_edges);
! 	  if (flag_indirect_inlining)
  	    add_new_edges_to_heap (heap, new_indirect_edges);
  
  	  update_callee_keys (heap, callee, updated_nodes);
--- 1045,1051 ----
  	    }
  	  callee = edge->callee;
  	  cgraph_mark_inline_edge (edge, true, &new_indirect_edges);
! 	  if (flag_indirect_inlining && !flag_wpa)
  	    add_new_edges_to_heap (heap, new_indirect_edges);
  
  	  update_callee_keys (heap, callee, updated_nodes);
*************** cgraph_decide_inlining (void)
*** 1114,1120 ****
    int initial_size = 0;
  
    cgraph_remove_function_insertion_hook (function_insertion_hook_holder);
!   if (in_lto_p && flag_indirect_inlining)
      ipa_update_after_lto_read ();
  
    max_count = 0;
--- 1114,1120 ----
    int initial_size = 0;
  
    cgraph_remove_function_insertion_hook (function_insertion_hook_holder);
!   if (in_lto_p && flag_indirect_inlining && !flag_wpa)
      ipa_update_after_lto_read ();
  
    max_count = 0;
*************** cgraph_decide_inlining (void)
*** 1268,1274 ****
      }
  
    /* Free ipa-prop structures if they are no longer needed.  */
!   if (flag_indirect_inlining)
      free_all_ipa_structures_after_iinln ();
  
    if (dump_file)
--- 1268,1274 ----
      }
  
    /* Free ipa-prop structures if they are no longer needed.  */
!   if (flag_indirect_inlining && !flag_wpa)
      free_all_ipa_structures_after_iinln ();
  
    if (dump_file)
*************** inline_transform (struct cgraph_node *no
*** 1975,1981 ****
  static void 
  inline_read_summary (void)
  {
!   if (flag_indirect_inlining)
      {
        ipa_register_cgraph_hooks ();
        if (!flag_ipa_cp)
--- 1975,1981 ----
  static void 
  inline_read_summary (void)
  {
!   if (flag_indirect_inlining && !flag_wpa)
      {
        ipa_register_cgraph_hooks ();
        if (!flag_ipa_cp)


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