public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] ipa: make target_clone default decl local [PR101726]
@ 2021-08-12 15:24 Martin Liška
  2021-08-13 16:58 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2021-08-12 15:24 UTC (permalink / raw)
  To: gcc-patches

When we have a target_clone *declaration*, it does not make sense doing
the default version local. The use-case in the PR is that the reporter
wants to implement the function in assembly.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

	PR ipa/101726

gcc/ChangeLog:

	* multiple_target.c (create_dispatcher_calls): Make default
	  function local only if it is a definition.
---
  gcc/multiple_target.c | 25 ++++++++++++++-----------
  1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c
index e4192657cef..6c0565880c5 100644
--- a/gcc/multiple_target.c
+++ b/gcc/multiple_target.c
@@ -170,17 +170,20 @@ create_dispatcher_calls (struct cgraph_node *node)
  				      clone_function_name_numbered (
  					  node->decl, "default"));
  
-  /* FIXME: copy of cgraph_node::make_local that should be cleaned up
-	    in next stage1.  */
-  node->make_decl_local ();
-  node->set_section (NULL);
-  node->set_comdat_group (NULL);
-  node->externally_visible = false;
-  node->forced_by_abi = false;
-  node->set_section (NULL);
-
-  DECL_ARTIFICIAL (node->decl) = 1;
-  node->force_output = true;
+  if (node->definition)
+    {
+      /* FIXME: copy of cgraph_node::make_local that should be cleaned up
+		in next stage1.  */
+      node->make_decl_local ();
+      node->set_section (NULL);
+      node->set_comdat_group (NULL);
+      node->externally_visible = false;
+      node->forced_by_abi = false;
+      node->set_section (NULL);
+
+      DECL_ARTIFICIAL (node->decl) = 1;
+      node->force_output = true;
+    }
  }
  
  /* Return length of attribute names string,
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipa: make target_clone default decl local [PR101726]
  2021-08-12 15:24 [PATCH] ipa: make target_clone default decl local [PR101726] Martin Liška
@ 2021-08-13 16:58 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2021-08-13 16:58 UTC (permalink / raw)
  To: Martin Liška, gcc-patches



On 8/12/2021 9:24 AM, Martin Liška wrote:
> When we have a target_clone *declaration*, it does not make sense doing
> the default version local. The use-case in the PR is that the reporter
> wants to implement the function in assembly.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
>     PR ipa/101726
>
> gcc/ChangeLog:
>
>     * multiple_target.c (create_dispatcher_calls): Make default
>       function local only if it is a definition.
OK
jeff


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-13 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 15:24 [PATCH] ipa: make target_clone default decl local [PR101726] Martin Liška
2021-08-13 16:58 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).