diff mbox

PR ipa/81185, Improve naming of target_clone cloned function names

Message ID 20170623015804.GA1892@ibm-tiger.the-meissners.org
State New
Headers show

Commit Message

Michael Meissner June 23, 2017, 1:58 a.m. UTC
he June 19th, 2017 change from Martin Liska  <mliska@suse.cz>, made the
target_clones support more usable, in that it it changed the external name from
being the default function to being the ifunc handler.  This means that calls
from other modules will call the appropriate clone based on what machine it is
running on.

The name generated for each of the clone functions for non-default
architectures has the string ".default.<number>" added to it, while it already
has the various names for the different architectures.

I tracked this down to create_dispatcher_calls getting called for each of the
clone functions, since they have the DECL_FUNCTION_VERISIONED bit set.

I have done bootstrap builds on both x86_64 and PowerPC and this patch builds
the current GCC and has no regressions in the test suite.  Can I check it into
the trunk?

2017-06-22  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR ipa/81185
	* multiple_target.c (create_dispatcher_calls): Only create the
	dispatcher call if the function is the default clone of a
	versioned function.

Comments

Martin Liška June 23, 2017, 7:02 a.m. UTC | #1
On 06/23/2017 03:58 AM, Michael Meissner wrote:
> he June 19th, 2017 change from Martin Liska  <mliska@suse.cz>, made the
> target_clones support more usable, in that it it changed the external name from
> being the default function to being the ifunc handler.  This means that calls
> from other modules will call the appropriate clone based on what machine it is
> running on.

Hello Michael.

Thanks for the fix, you did it in a very elegant way ;)

Martin
Jeff Law June 23, 2017, 5:13 p.m. UTC | #2
On 06/22/2017 07:58 PM, Michael Meissner wrote:
> he June 19th, 2017 change from Martin Liska  <mliska@suse.cz>, made the
> target_clones support more usable, in that it it changed the external name from
> being the default function to being the ifunc handler.  This means that calls
> from other modules will call the appropriate clone based on what machine it is
> running on.
> 
> The name generated for each of the clone functions for non-default
> architectures has the string ".default.<number>" added to it, while it already
> has the various names for the different architectures.
> 
> I tracked this down to create_dispatcher_calls getting called for each of the
> clone functions, since they have the DECL_FUNCTION_VERISIONED bit set.
> 
> I have done bootstrap builds on both x86_64 and PowerPC and this patch builds
> the current GCC and has no regressions in the test suite.  Can I check it into
> the trunk?
> 
> 2017-06-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
> 
> 	PR ipa/81185
> 	* multiple_target.c (create_dispatcher_calls): Only create the
> 	dispatcher call if the function is the default clone of a
> 	versioned function.
OK
jeff
diff mbox

Patch

Index: gcc/multiple_target.c
===================================================================
--- gcc/multiple_target.c	(revision 249569)
+++ gcc/multiple_target.c	(working copy)
@@ -64,7 +64,8 @@  create_dispatcher_calls (struct cgraph_n
 {
   ipa_ref *ref;
 
-  if (!DECL_FUNCTION_VERSIONED (node->decl))
+  if (!DECL_FUNCTION_VERSIONED (node->decl)
+      || !is_function_default_version (node->decl))
     return;
 
   auto_vec<cgraph_edge *> edges_to_redirect;