Hi,

PR 49796 is basically a bug in the verifier.  If IPA-CP creates a
clone of a node (__base_ctor) which also has an alias (__comp_ctor),
normally the verifier is able to trace both to the original node and
be happy but if the node ends up in a different partition, the alias
information is lost and verifier wrongly aborts the compilation.

I discussed this with Honza yesterday and he pre-approved a patch
dumbing down the verifier if the node from the statement decl comes
from a different partition.  That is what the patch below does.

I have used the opportunity to clean up
verify_edge_corresponds_to_fndecl a bit, mostly so that it calls
cgraph_get_node just once.  I acknowledge there is still an
inconsistency with regard to e->calle, at one point we do use
cgraph_function_or_thunk_node on it and twice we don't which was added
by Honza when introducing alias an thunk nodes.  I think it should
never be necessary unless we ourselves create thunks/aliases for
artificial clones.  So I kept it as it was.

Bootstrapped and tested on x86_64-linux, I also verified it fixed
xalancbmk.  Since it was basically pre-approved, I will commit it
later today if there are no objections.

Thanks,

Martin


2011-07-21  Martin Jambor  <mjam...@suse.cz>

        PR lto/49796
        * cgraphunit.c (verify_edge_corresponds_to_fndecl): Return false
        if decl node is in another partition, call cgraph_get_node only
        once.

Index: src/gcc/cgraphunit.c
===================================================================
*** src.orig/gcc/cgraphunit.c
--- src/gcc/cgraphunit.c
*************** cgraph_debug_gimple_stmt (struct functio
*** 456,472 ****
  static bool
  verify_edge_corresponds_to_fndecl (struct cgraph_edge *e, tree decl)
  {
!   if (!e->callee->global.inlined_to
!       && decl
!       && cgraph_get_node (decl)
!       && (e->callee->former_clone_of
!         != cgraph_function_or_thunk_node (cgraph_get_node (decl), NULL)->decl)
        /* IPA-CP sometimes redirect edge to clone and then back to the former
         function.  This ping-pong has to go, eventaully.  */
!       && (cgraph_function_or_thunk_node (cgraph_get_node (decl), NULL)
!         != cgraph_function_or_thunk_node (e->callee, NULL))
!       && !clone_of_p (cgraph_get_node (decl),
!                     e->callee))
      return true;
    else
      return false;
--- 456,478 ----
  static bool
  verify_edge_corresponds_to_fndecl (struct cgraph_edge *e, tree decl)
  {
!   struct cgraph_node *node;
! 
!   if (!decl || e->callee->global.inlined_to)
!     return false;
!   node = cgraph_get_node (decl);
! 
!   /* We do not know if a node from a different partition is an alias or what 
it
!      aliases and therefore cannot do the former_clone_of check reliably.  */
!   if (!node || node->in_other_partition)
!     return false;
!   node = cgraph_function_or_thunk_node (node, NULL);
! 
!   if ((e->callee->former_clone_of != node->decl)
        /* IPA-CP sometimes redirect edge to clone and then back to the former
         function.  This ping-pong has to go, eventaully.  */
!       && (node != cgraph_function_or_thunk_node (e->callee, NULL))
!       && !clone_of_p (node, e->callee))
      return true;
    else
      return false;



Reply via email to