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

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The bug is that ipa-cp disagrees about ipa-prop whether the call is speculative
or not. I am testing:

Index: ipa-prop.c
===================================================================
--- ipa-prop.c  (revision 219700)
+++ ipa-prop.c  (working copy)
@@ -2985,7 +2985,7 @@ try_make_edge_direct_virtual_call (struc
                  || !possible_polymorphic_call_target_p
                       (ie, cgraph_node::get (t)))
                {
-                 /* Do not speculate builtin_unreachable, it is stpid!  */
+                 /* Do not speculate builtin_unreachable, it is stupid!  */
                  if (!ie->indirect_info->vptr_changed)
                    target = ipa_impossible_devirt_target (ie, target);
                }
@@ -3013,6 +3013,7 @@ try_make_edge_direct_virtual_call (struc
      ctx, &final);
   if (final && targets.length () <= 1)
     {
+      speculative = false;
       if (targets.length () == 1)
        target = targets[0]->decl;
       else
Index: ipa-cp.c
===================================================================
--- ipa-cp.c    (revision 219700)
+++ ipa-cp.c    (working copy)
@@ -1975,8 +1975,13 @@ ipa_get_indirect_edge_target_1 (struct c
        }
     }
   else if (t)
-    context = ipa_polymorphic_call_context (t, ie->indirect_info->otr_type,
-                                           anc_offset);
+    {
+      context = ipa_polymorphic_call_context (t, ie->indirect_info->otr_type,
+                                             anc_offset);
+      if (ie->indirect_info->vptr_changed)
+       context.possible_dynamic_type_change (ie->in_polymorphic_cdtor,
+                                             ie->indirect_info->otr_type);
+    }
   else
     return NULL_TREE;

Reply via email to