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: [PATCH] Devirtualization within ipa-cp


On Tue, Sep 21, 2010 at 7:54 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Sep 21, 2010 at 7:47 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Aug 4, 2010 at 12:06 PM, Martin Jambor <mjambor@suse.cz> wrote:
>>> Hi,
>>>
>>> this patch adds devirtualization capabilities to the IPA_CP pass. ?In
>>> addition to gathering standard constant-propagation lattices it also
>>> keeps a list of all possible types an argument can have whenever we
>>> can track all of them and if their number is smaller than a newly
>>> introduced parameter devirt-type-list-size. ?The pass then goes over
>>> the (outgoing) indirect call graph edges and if the type information
>>> can make them direct - it is a virtual call, the object is a parameter
>>> of known types and the called method is the same for all of them - it
>>> is made direct. ?Finally, cgraph_redirect_edge_call_stmt_to_callee in
>>> cgraphunit.c is taught to change the function declarations in call
>>> statements accordingly.
>>>
>>> The default value of devirt-type-list-size is 8. ?This is so far only
>>> a rather wild guess, I intend to change it after I looked at how big
>>> the lists get when compiling firefox with whopr.
>>>
>>> Bootstrapped and tested on x86_64-linux without any problems. ?I'm
>>> sure there will be comments and requests for changes, nevertheless
>>> after I address those, I'd like to commit it to trunk.
>>>
>>> Thanks,
>>>
>>> Martin
>>>
>>>
>>> 2010-08-03 ?Martin Jambor ?<mjambor@suse.cz>
>>>
>>> ? ? ? ?* ipa-prop.h (enum ipa_lattice_type): Changed comments.
>>> ? ? ? ?(struct ipa_param_descriptor): New fields types and
>>> ? ? ? ?cannot_devirtualize.
>>> ? ? ? ?(ipa_param_cannot_devirtualize_p): New function.
>>> ? ? ? ?(ipa_param_types_vec_empty): Likewise.
>>> ? ? ? ?(ipa_make_edge_direct_to_target): Declare.
>>> ? ? ? ?* ipa-cp.c: Fixed first stage driver name in initial comment,
>>> ? ? ? ?described devirtualization there too.
>>> ? ? ? ?(ipcp_analyze_node): Call ipa_analyze_params_uses.
>>> ? ? ? ?(ipcp_print_all_lattices): Print devirtualization info.
>>> ? ? ? ?(ipa_set_param_cannot_devirtualize): New function.
>>> ? ? ? ?(ipcp_initialize_node_lattices): Set cannot_devirtualize when setting
>>> ? ? ? ?lattice to BOTTOM.
>>> ? ? ? ?(ipcp_init_stage): Merged into...
>>> ? ? ? ?(ipcp_generate_summary): ...its caller.
>>> ? ? ? ?(ipcp_change_tops_to_bottom): Also process type lists.
>>> ? ? ? ?(ipcp_add_param_type): New function.
>>> ? ? ? ?(ipcp_copy_types): Likewise.
>>> ? ? ? ?(ipcp_propagate_types): Likewise.
>>> ? ? ? ?(ipcp_propagate_stage): Also propagate types.
>>> ? ? ? ?(ipcp_need_redirect_p): Variable jump_func moved to its scope block.
>>> ? ? ? ?Also return true if propagated types require it.
>>> ? ? ? ?(ipcp_update_callgraph): Dump redirection info.
>>> ? ? ? ?(ipcp_process_devirtualization_opportunities): New function.
>>> ? ? ? ?(ipcp_const_param_count): Include known type information.
>>> ? ? ? ?(ipcp_insert_stage): Call ipcp_process_devirtualization_opportunities
>>> ? ? ? ?on new node. ?Fixed formatting.
>>> ? ? ? ?* ipa-prop.c (make_edge_direct_to_target): Renamed to
>>> ? ? ? ?ipa_make_edge_direct_to_target and changed all callers. ?Made
>>> ? ? ? ?externally visible.
>>> ? ? ? ?(ipa_node_duplication_hook): Duplicate types vector.
>>> ? ? ? ?* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Also try to
>>> ? ? ? ?redirect outgoing calls for which we can't get a decl from the
>>> ? ? ? ?statement. ?Check that we can get a decl from the call statement.
>>> ? ? ? ?* ipa-inline.c (inline_indirect_intraprocedural_analysis): Call
>>> ? ? ? ?ipa_analyze_params_uses only when ipa-cp is disabled.
>>> ? ? ? ?* tree-inline.c (get_indirect_callee_fndecl): Removed.
>>> ? ? ? ?(expand_call_inline): Do not call get_indirect_callee_fndecl.
>>> ? ? ? ?* params.def (PARAM_DEVIRT_TYPE_LIST_SIZE): New parameter.
>>>
>>> ? ? ? ?* testsuite/g++.dg/ipa/devirt-1.C: New test.
>>> ? ? ? ?* testsuite/g++.dg/ipa/devirt-2.C: Likewise.
>>> ? ? ? ?* testsuite/g++.dg/ipa/devirt-3.C: Likewise.
>>> ? ? ? ?* testsuite/g++.dg/ipa/devirt-4.C: Likewise.
>>> ? ? ? ?* testsuite/g++.dg/ipa/devirt-5.C: Likewise.
>>> ? ? ? ?* testsuite/gcc.dg/ipa/iinline-3.c: Likewise.
>>>
>>>
>>
>> This caused:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45563
>>
>
>
> It also caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45562

This also caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47355


-- 
H.J.


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