[trans-mem] ipa pass for tm function cloning

Richard Henderson rth@redhat.com
Tue Nov 11 18:45:00 GMT 2008


Jan Hubicka wrote:
> The overall plan is to keep function summaries and result of IPA
> propagation in local arrays at the time analysis is done (that is at
> compile time).  Then use the hooks to keep the summaries up to date as
> the callgraph is modified (basically new functions are added/old
> removed).

That's fair enough.  But a good description somewhere of what sorts
of things you'd want to generate in an ipa summary (as opposed to
the kind of data you'd just collect during the execute pass of a
simple_ipa_pass), as well as a description of all the kinds of hooks
available would be extremely helpful.

Because really, ignoring the LTO bits, I can't see that any of the
existing IPA passes should be anything but simple_ipa_passes.   That
they aren't merely complicates understanding of what's going on in
them.

>> +  new_node = cgraph_function_versioning (old_node, redirections,
>> +					 NULL, NULL);
>> +
>> +  /* ??? Versioning can fail at the discression of the inliner.  */
>> +  if (new_node == NULL)
>> +    return;
> 
> In this case we end up with calls to undefined symbols?
> (as per comment in tree_versionable_function_p we should relax
> restrictions there.  Variadic functions or setjmp can be clonned, but
> function having local labels with address taken and escaping can not I
> guess)

Local labels can be duplicated as well.  And it's not like you can
jump to them from other functions, so escaping labels don't really
prevent versioning either.

In the end I'm no longer using cgraph_function_versioning because
it's too focused on versioning for optimization, whereas I'm dealing
with versioning to fulfill the API.  I have documented external
assembler names that correspond to functions that have been marked
with the tm_callable attribute by the user.

>> +  /* ??? In tree_function_versioning, we futzed with the DECL_NAME.  I'm
>> +     not sure why we did this, as it's surely going to destroy any hope
>> +     of debugging.  */
>> +  DECL_NAME (new_node->decl) = DECL_NAME (old_node->decl);
> 
> As far as I can remember, we discussed this while ipa-cp implementation
> was merged.  I was not very happy about T.123456 style of naming of the
> clones but I was told that debug info should preserve the old names
> nicely.  So this seems like tree_function_versioning bug.
> Perhaps all the logic for producing weak clones and clones with sane
> name should be pushed to the versioning code so the clone names in
> general have generic suffixes that tells who has created the clone?

That's what I've done.  The DECL_NAME frobbing now lives in
cgraph_function_versioning, and tree_function_versioning merely
handles the duplication of the function body.



r~



More information about the Gcc-patches mailing list