diff mbox

PR other/51174: handle architectures with no DECL_COMDAT_GROUP

Message ID CAGWvnyk8VF96_t1eepVKCgKKHas-H4=VOCfgyq7uDMYdhz-0aA@mail.gmail.com
State New
Headers show

Commit Message

David Edelsohn Nov. 29, 2011, 4:22 p.m. UTC
On Mon, Nov 28, 2011 at 7:02 PM, Richard Henderson <rth@redhat.com> wrote:
> On 11/28/2011 03:54 PM, David Edelsohn wrote:
>> On Wed, Nov 23, 2011 at 8:57 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>>> On Wed, Nov 23, 2011 at 07:47:46AM -0600, Aldy Hernandez wrote:
>>>>>> @@ -4198,7 +4198,7 @@ ipa_tm_create_version_alias (struct cgra
>>>>>>   TREE_SYMBOL_REFERENCED (tm_name) = 1;
>>>>>>
>>>>>>   /* Perform the same remapping to the comdat group.  */
>>>>>> -  if (DECL_COMDAT (new_decl))
>>>>>> +  if (HAVE_COMDAT_GROUP&&  DECL_COMDAT (new_decl))
>>>>>>     DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
>>>>>>
>>>>>>   new_node = cgraph_same_body_alias (NULL, new_decl, info->new_decl);
>>>
>>> Wouldn't it be better to test if (DECL_ONE_ONLY (new_decl))
>>> instead?  That is actually test for non-NULL DECL_COMDAT_GROUP
>>> and is what e.g. cp/ uses as guards on tweaking DECL_COMDAT_GROUP.
>>>
>>> BTW, the formatting is wrong above, no space before && and two spaces after
>>> it.
>>
>> That will work as well.
>>
>> Which solution should be committed?
>
> Please use the DECL_ONE_ONLY test.

A patch using DECL_ONE_ONLY works for me as well.  Can someone approve
that version of the patch?

        * trans-mem.c (ipa_tm_create_version_alias): Mangle new_decl
if DECL_ONE_ONLY.
        (ipa_tm_create_version): Same.

Thanks, David

Comments

Jakub Jelinek Nov. 29, 2011, 4:28 p.m. UTC | #1
On Tue, Nov 29, 2011 at 11:22:15AM -0500, David Edelsohn wrote:
> A patch using DECL_ONE_ONLY works for me as well.  Can someone approve
> that version of the patch?

This is ok for the trunk, thanks.

>         * trans-mem.c (ipa_tm_create_version_alias): Mangle new_decl
> if DECL_ONE_ONLY.
>         (ipa_tm_create_version): Same.
> 
 > --- trans-mem.c (revision 181793)
> +++ trans-mem.c (working copy)
> @@ -4213,7 +4213,7 @@ ipa_tm_create_version_alias (struct cgra
>    TREE_SYMBOL_REFERENCED (tm_name) = 1;
> 
>    /* Perform the same remapping to the comdat group.  */
> -  if (DECL_COMDAT (new_decl))
> +  if (DECL_ONE_ONLY (new_decl))
>      DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
> 
>    new_node = cgraph_same_body_alias (NULL, new_decl, info->new_decl);
> @@ -4248,7 +4248,7 @@ ipa_tm_create_version (struct cgraph_nod
>    TREE_SYMBOL_REFERENCED (tm_name) = 1;
> 
>    /* Perform the same remapping to the comdat group.  */
> -  if (DECL_COMDAT (new_decl))
> +  if (DECL_ONE_ONLY (new_decl))
>      DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
> 
>    new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL, NULL);

	Jakub
diff mbox

Patch

Index: trans-mem.c
===================================================================
--- trans-mem.c (revision 181793)
+++ trans-mem.c (working copy)
@@ -4213,7 +4213,7 @@  ipa_tm_create_version_alias (struct cgra
   TREE_SYMBOL_REFERENCED (tm_name) = 1;

   /* Perform the same remapping to the comdat group.  */
-  if (DECL_COMDAT (new_decl))
+  if (DECL_ONE_ONLY (new_decl))
     DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));

   new_node = cgraph_same_body_alias (NULL, new_decl, info->new_decl);
@@ -4248,7 +4248,7 @@  ipa_tm_create_version (struct cgraph_nod
   TREE_SYMBOL_REFERENCED (tm_name) = 1;

   /* Perform the same remapping to the comdat group.  */
-  if (DECL_COMDAT (new_decl))
+  if (DECL_ONE_ONLY (new_decl))
     DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));

   new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL, NULL);