> 2013-08-23 Martin Jambor <mjam...@suse.cz> > > * ipa-prop.h (ipa_pass_through_data): New field type_preserved. > (ipa_ancestor_jf_data): Likewise. > (ipa_get_jf_pass_through_agg_preserved): Fix comment typo. > (ipa_get_jf_pass_through_type_preserved): New function. > (ipa_get_jf_ancestor_agg_preserved): Fix comment typo. > (ipa_get_jf_ancestor_type_preserved): New function. > * ipa-cp.c (ipa_get_jf_pass_through_result): Honor type_preserved > flag. > (ipa_get_jf_ancestor_result): Likewise. > (propagate_vals_accross_pass_through): Use > ipa_get_jf_pass_through_result to do all the value mappings. > * ipa-prop.c (ipa_print_node_jump_functions_for_edge): Dump the > type_preserved flag. > (ipa_set_jf_cst_copy): New function. > (ipa_set_jf_simple_pass_through): Set the type_preserved flag. > (ipa_set_jf_arith_pass_through): Likewise. > (ipa_set_ancestor_jf): Likewise. > (compute_complex_assign_jump_func): Set type_preserved instead of > punting. > (ipa_compute_jump_functions_for_edge): Likewise. > (combine_known_type_and_ancestor_jfs): Honor type_preserved. > (update_jump_functions_after_inlining): Update type_preserved. > Explicitely create jump functions when combining one with > pass_through. > (ipa_write_jump_function): Stream the type_preserved flags. > (ipa_read_jump_function): Likewise. > + if (TREE_CODE (input) == TREE_BINFO) > + { > + if (ipa_get_jf_pass_through_type_preserved (jfunc)) > + { > + gcc_checking_assert (ipa_get_jf_pass_through_operation (jfunc) > + == NOP_EXPR); > + return input; > + } > + return NULL_TREE; > + } To handle the types in construction well, I plan to extend possible_polymorphic_call_targets to get an OUTER_TYPE, OFFSET, INCLUDE_BASES, INCLUDE_DERIVED_TYPES arguments (in addition to existing OTR_TYPE and OTR_TOKEN). OUTER_TYPE and OFFSET is what we now pass into get_binfo_at_offset (i.e. the dynamic type of object we can track and offset of our subobject we have virtual call for), where INCLUDE_BASES if true will make it to record all the mathcing virtual methods of basetypes of OTR_TYPE, while INCLUDE_DERIVED_TYPES will make it to record all matchng virtual methods of derived types of OUTER_TYPE. If both are NULL, it will do what get_binfo_at_offset does currently. Does it seem to work for you?
In the case you have !ipa_get_jf_pass_through_type_preserved, I believe you will just set INCLUDE_BASES (since you do not know if outer_type is in construction) The INCLUDE_DERIVED_TYPES will be useful when we know the outer_object comes from THIS pointer of a method that is not a constructor. I this case we know that the type is either type of object the method is defined for or one of its derivations. Again if outer type is in construction (i.e. the method is constructor or destructor) we will have both INCLUDE_DERIVED_TYPES and INCLUDE_BASES set. The list will still be smaller than what we get now purely on the type of the virtual call object. Does this seem work for you? the patch is OK, thank you! Honza