This is the mail archive of the gcc@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]

[lto] Problems with cgraph_state updating


Jan,

I've run into a problem with cgraph_state that illustrates some of the
issues I have with the cgraph machinery.  We are currently relying on
pass_all_early_optimizations to move cgraph_state from
CGRAPH_STATE_IPA to CGRAPH_STATE_IPA_SSA:

static unsigned int
execute_early_local_optimizations (void)
{
  /* First time we start with early optimization we need to advance
     cgraph state so newly inserted functions are also early optimized.
     However we execute early local optimizations for lately inserted
     functions, in that case don't reset cgraph state back to IPA_SSA.  */
  if (cgraph_state < CGRAPH_STATE_IPA_SSA)
    cgraph_state = CGRAPH_STATE_IPA_SSA;
  return 0;
}

The problem is that when lto1 is running, we do not execute this pass
because it is not needed (it was already executed during cc1/cc1plus),
so this state transition never takes place.

I think there are two problematic aspects to this.  First, the very
existence of cgraph_state as a global variable accessible from
anywhere.  This variable is checked during SSA verification, so the
verifiers are context sensitive.  We should, at the very least, hide
this variable from outside of the cgraph machinery.

The other problem is that we are relying on an optimization pass to
set properties for the cgraph, this should be something done by the
pass manager itself or the cgraph routines (maybe via a TODO_*).  I've
replicated this update inside ipa_passes() but this is sub-optimal.

So, there should be a clear state transition in the cgraph and the
transition should be controlled by cgraph/pass-manager code.  Where
could that be?


Thanks.  Diego.


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