* [PATCH] ipa: do not make localaliases for target_clones [PR101261]
@ 2021-08-13 10:11 Martin Liška
2021-08-13 10:23 ` Jan Hubicka
0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2021-08-13 10:11 UTC (permalink / raw)
To: gcc-patches; +Cc: Jan Hubicka
Hello.
Right now, target_clone pass complains when a target_clone function is an alias.
That happens when localalias is created by callgraph. I think we should not create
such aliases as we won't benefit much from it in case of target_clones.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
PR ipa/101261
gcc/ChangeLog:
* symtab.c (symtab_node::noninterposable_alias): Do not create
local aliases for target_clone functions as the clonning pass
rejects aliases.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr101261.c: New test.
---
gcc/symtab.c | 2 ++
gcc/testsuite/gcc.target/i386/pr101261.c | 11 +++++++++++
2 files changed, 13 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/pr101261.c
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 8c4cb70b015..c7ea8ecef74 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -1959,6 +1959,8 @@ symtab_node::noninterposable_alias (void)
/* If aliases aren't supported by the assembler, fail. */
if (!TARGET_SUPPORTS_ALIASES)
return NULL;
+ else if (lookup_attribute ("target_clones", DECL_ATTRIBUTES (node->decl)))
+ return NULL;
/* Otherwise create a new one. */
new_decl = copy_node (node->decl);
diff --git a/gcc/testsuite/gcc.target/i386/pr101261.c b/gcc/testsuite/gcc.target/i386/pr101261.c
new file mode 100644
index 00000000000..d25d1a202c2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101261.c
@@ -0,0 +1,11 @@
+/* PR middle-end/101261 */
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-fno-semantic-interposition -fPIC" } */
+/* { dg-require-ifunc "" } */
+
+void
+__attribute__((target_clones("default", "avx2")))
+dt_ioppr_transform_image_colorspace()
+{
+ dt_ioppr_transform_image_colorspace();
+}
--
2.32.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ipa: do not make localaliases for target_clones [PR101261]
2021-08-13 10:11 [PATCH] ipa: do not make localaliases for target_clones [PR101261] Martin Liška
@ 2021-08-13 10:23 ` Jan Hubicka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2021-08-13 10:23 UTC (permalink / raw)
To: Martin Liška; +Cc: gcc-patches
> Hello.
>
> Right now, target_clone pass complains when a target_clone function is an alias.
> That happens when localalias is created by callgraph. I think we should not create
> such aliases as we won't benefit much from it in case of target_clones.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
OK, thanks
Honza
> Thanks,
> Martin
>
> PR ipa/101261
>
> gcc/ChangeLog:
>
> * symtab.c (symtab_node::noninterposable_alias): Do not create
> local aliases for target_clone functions as the clonning pass
> rejects aliases.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/i386/pr101261.c: New test.
> ---
> gcc/symtab.c | 2 ++
> gcc/testsuite/gcc.target/i386/pr101261.c | 11 +++++++++++
> 2 files changed, 13 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/i386/pr101261.c
>
> diff --git a/gcc/symtab.c b/gcc/symtab.c
> index 8c4cb70b015..c7ea8ecef74 100644
> --- a/gcc/symtab.c
> +++ b/gcc/symtab.c
> @@ -1959,6 +1959,8 @@ symtab_node::noninterposable_alias (void)
> /* If aliases aren't supported by the assembler, fail. */
> if (!TARGET_SUPPORTS_ALIASES)
> return NULL;
> + else if (lookup_attribute ("target_clones", DECL_ATTRIBUTES (node->decl)))
> + return NULL;
> /* Otherwise create a new one. */
> new_decl = copy_node (node->decl);
> diff --git a/gcc/testsuite/gcc.target/i386/pr101261.c b/gcc/testsuite/gcc.target/i386/pr101261.c
> new file mode 100644
> index 00000000000..d25d1a202c2
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr101261.c
> @@ -0,0 +1,11 @@
> +/* PR middle-end/101261 */
> +/* { dg-do compile { target fpic } } */
> +/* { dg-options "-fno-semantic-interposition -fPIC" } */
> +/* { dg-require-ifunc "" } */
> +
> +void
> +__attribute__((target_clones("default", "avx2")))
> +dt_ioppr_transform_image_colorspace()
> +{
> + dt_ioppr_transform_image_colorspace();
> +}
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-13 10:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 10:11 [PATCH] ipa: do not make localaliases for target_clones [PR101261] Martin Liška
2021-08-13 10:23 ` Jan Hubicka
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).