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]

Re: Fix profile updating during recursive inlining


Hello,

with this patch gcc runs into an endless loop when using profile
directed feedback in combination with recursive functions. I could
reproduce this failure on i686 and s390x with the same file. 
If I revert the patch no problem occurs.

> 2005-09-23  Jan Hubicka  <jh@suse.cz>
> 	* cgraph.c (cgraph_clone_edge): Make the scale gcov_type.
> 	(cgraph_clone_node): Likewise.
> 	* cgraph.h (cgraph_clone_edge): Update prototype.
> 	(cgraph_mark_inline_edge, cgraph_clone_inlined_nodes): Remove
> 	duplicated prototypes; add updating argument.
> 	* cgraphunit.c (verify_cgraph_node): Verify that counts are non-negative.
> 	* ipa-inline.c (cgraph_clone_inlined_nodes): Allow clonning without
> 	updating profile.
> 	(cgraph_mark_inline_edge): Likewise.
> 	(cgraph_mark_inline): Update use of cgraph_mark_inline_edge.
> 	(cgraph_flatten_node): Likewise.
> 	(cgraph_decide_recursive_inlining): Likewise.
> 	(cgraph_decide_inlining_of_small_function): Likewise.
> 	* tree-optimize.c (tree_rest_of_compilation): Likewise.

Unfortunately I can't provide the testcase because it's part of the
SpecCPU testsuite. In case you have access to the SpecCPU source:
197.parser/build-disjuncts.c function: maxcost_of_expression

The while loop in ipa-inline.c: cgraph_decide_inlining_of_small_functions
can't be left:

while (overall_insns <= max_insns && (edge = fibheap_extract_min (heap)))

overall_insns <= max_insns: The only location where overall_insns is increased is
in cgraph_mark_inline_edge but this isn't done because inlining the edge choosen
by fibheap_extract_min would exceed the depth limit in cgraph_decide_recursive_inlining.

edge = fibheap_extract_min (heap): This returns always the same edge which is 
re-added by update_caller_keys with a very low badness value and therefore is
returned by the next call to fibheap_extract_min.

Could you please have a look at this?

Bye,

-Andreas-


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