On Sun, Oct 5, 2014 at 9:34 AM, Jan Hubicka <hubi...@ucw.cz> wrote:
> Hi,
> this patch makes ipa_polymorphic_call_context::get_dynamic_type to
> track if vptr has changed in between function entry and polymorphic
> call.
>
> The patch also add logic skipping if (a==0) checks in multiple
> inheritance so I can construct testcase more easily.
>
> I got my SVN tree into an inconsistent state yesterday by stopping in
> middle of commit.  The patch went in in two parts, so i am attaching
> both changes. Quite few of devirt-4*.C was broken overnight, I apologize
> for that.
>
> Honza
>
>         * ipa-polymorphic-call.c (walk_ssa_copies): Recognize
>         NULL pointer checks.
>         (ipa_polymorphic_call_context::get_dynamic_type): Return true
>         if type doesn't change.
>         * cgraph.h (cgraph_indirect_call_info): New flag.
>         * cgraph.c (cgraph_node::create_indirect_edge): Initialize it.
>         (cgraph_node::dump): Dump it.
>         * ipa-prop.c (ipa_analyze_call_uses):  Ignore return valud
>         of context.get_dynamic_type.
>         (ipa_make_edge_direct_to_target): Do not speculate
>         edge that is already speuclative.
>         (try_make_edge_direct_virtual_call): Use VPTR_CHANGED; Do not
>         speculate to __builtin_unreachable
>         (ipa_write_indirect_edge_info, ipa_read_indirect_edge_info): Stream
>         vptr_changed.
>         * ipa-cp.c (ipa_get_indirect_edge_target_1): Use vptr_changed.
>         * g++.dg/ipa/devirt-47.C: New testcase.
>
>         * ipa-polymorphic-call.c (possible_placement_new): Fix condition
>         on size.
>         (ipa_polymorphic_call_context::restrict_to_inner_type): Do not walk
>         into vptr pointer.
>         (ipa_polymorphic_call_context::dump): Fix formating.
>         * ipa-prop.c (ipa_analyze_call_uses): Compute vptr_changed.
>
>         * g++.dg/ipa/devirt-42.C: Update template.
>         * g++.dg/ipa/devirt-44.C: Update template.
>         * g++.dg/ipa/devirt-45.C: Update template.
>         * g++.dg/ipa/devirt-46.C: Update template.
>         * g++.dg/ipa/devirt-47.C: Update template.
>         * g++.dg/ipa/devirt-48.C: New testcase.
===================================================================
> --- testsuite/g++.dg/ipa/devirt-47.C    (revision 215901)
> +++ testsuite/g++.dg/ipa/devirt-47.C    (working copy)
> @@ -23,7 +23,7 @@ m()
>    return 0;
>  }
>
> -/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a 
> speculative target\[^\\n\]*C::_ZTh" 1 "inline"  } } */
> +/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known 
> target\[^\\n\]*C::_ZTh" 1 "inline"  } } */
>  /* { dg-final { scan-ipa-dump-not "OBJ_TYPE_REF" "optimized"  } } */
>  /* FIXME: We ought to inline thunk.  */
>  /* { dg-final { scan-ipa-dump "C::_ZThn" "optimized"  } } */

It fails for x32:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63828

Is this expected?

-- 
H.J.

Reply via email to