On Wed, Jan 24 2018, Richard Biener wrote:
> On January 24, 2018 5:16:45 PM GMT+01:00, Jakub Jelinek <ja...@redhat.com> 
> wrote:
>>On Wed, Jan 24, 2018 at 05:08:10PM +0100, Richard Biener wrote:
>>> >The "omp declare simd" attribute refers to argument numbers of the
>>> >functions, so trying to apply it on versioned functions that can
>>> >perhaps
>>> >have different number and types of arguments results in ICEs or
>>> >wrong-code.
>>> >Unfortunately, if simd attribute or #pragma omp declare simd is used
>>> >on C++ ctors or dtors, those have DECL_ABSTRACT_ORIGIN of something
>>> >that
>>> >really doesn't exist, abstract ctor or dtor, so checking if
>>> >the types of node->decl and its DECL_ABSTRACT_ORIGIN are compatible
>>> >function
>>> >types doesn't work.
>>> 
>>> So if the attribute is on the decl we clone it should be in the list
>>of things that cloning adjusts or blocks cloning. 
>>
>>Yeah, guess I could move the attribute removal code from omp-low.c to
>>some
>>helper function and in tree_function_versioning check if the attribute
>>is
>>present and if yes and the old/new function types don't match, drop the
>>attribute.  Or, add some flag to cgraph whether the attribute should be
>>honored or not, and clear it in tree_function_versioning and
>>omp_create_child_function instead of removing the attribute.
>
> I think there's already a set of attributes that prevent cloning and
> or are adjusted by the IPA param machinery. The Martins or Honza
> should know better.

I am not sure I understand the problem but if
tree_versionable_function_p returns false, the local.versionable bit is
not set and no cloning for that function happens.

If it is sufficient that IPA-CP and other IPA passes do not change the
function type in any way (in practice that they don't remove
parameters), it is sufficient to clear the local.can_change_signature
cgraph flag in compute_fn_summary() in ipa-fnsummary.c.  That is how we
handle, or rather avoid handling, fnspec attributes.

Martin

Reply via email to