This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Elimination of no longer needed functions with address taken
On Thu, May 13, 2010 at 8:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, May 12, 2010 at 2:44 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> Hi,
>> this patch finishes the transition to ipa-ref from old reachability code by
>> making address_taken flag on cgraph node to not imply needed flag. ?Needed flag
>> has meaning "for unknown reason you must not touch this node" and thus we was
>> never able to eliminate function from unit whose address was no longer taken
>> after optimization.
>>
>> It would be cheap to check that vector of nodes refering function has size of
>> 0, but I think we might want to check the flag during local passes so it is
>> probably better to keep flag around.
>>
>> I hope this will be especially interesting in combination with indirect
>> inlining and devirtualisation and fact that we ought now be able to optimize
>> out dead virtual tables in many cases.
>>
>> Bootstrapped/regtested x86_64-linux, will commit it shortly.
>>
>> ? ? ? ?* cgraph.c (cgraph_mark_address_taken_node): No longer imply needed flag.
>> ? ? ? ?* cgraph.h (cgraph_only_called_directly_p,
>> ? ? ? ?cgraph_can_remove_if_no_direct_calls_p): test address_taken flag.
>> ? ? ? ?(cgraph_can_remove_if_no_direct_calls_and_refs_p): New function.
>> ? ? ? ?* cgraphunit.c (cgraph_mark_functions_to_output): Test address_taken.
>> ? ? ? ?(assemble
>> ? ? ? ?* ipa.c (cgraph_remove_unreachable_nodes): Use
>> ? ? ? ?cgraph_can_remove_if_no_direct_calls_and_refs_p; clear address_taken flags.
>> ? ? ? ?* tree-inline.c (copy_bb): Check address_taken flag.
>> ? ? ? ?* tree-profile.c (tree_gen_ic_func_profiler): Check address_taken and
>> ? ? ? ?externally_visible flag.
>>
>> ? ? ? ?* tree-ssa/unreachable.c: New test.
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44112
>
This also caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44206
--
H.J.