From a9a98049847fd8bafbb352818dd3ac86ff6ebf07 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 16 Mar 2018 15:53:24 +0100 Subject: [PATCH] Properly redirect alias for MVC (PR ipa/84722). 2018-03-16 Martin Liska PR ipa/84722 * multiple_target.c (create_dispatcher_calls): Redirect also an alias. 2018-03-16 Martin Liska PR ipa/84722 * gcc.target/i386/mvc10.c: New test. From-SVN: r258595 --- gcc/ChangeLog | 6 ++++++ gcc/multiple_target.c | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/mvc10.c | 16 ++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/mvc10.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 627700ae9bd..96b45d4d2f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-16 Martin Liska + + PR ipa/84722 + * multiple_target.c (create_dispatcher_calls): Redirect also + an alias. + 2018-03-16 Jakub Jelinek PR c++/79937 diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c index a6767985774..95297f3cd30 100644 --- a/gcc/multiple_target.c +++ b/gcc/multiple_target.c @@ -145,6 +145,13 @@ create_dispatcher_calls (struct cgraph_node *node) walk_gimple_stmt (&it, NULL, replace_function_decl, &wi); } } + else if (ref->use == IPA_REF_ALIAS) + { + symtab_node *source = ref->referring; + ref->remove_reference (); + source->create_reference (inode, IPA_REF_ALIAS); + source->add_to_same_comdat_group (inode); + } else gcc_unreachable (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff2ac8b33be..d4fbd1b94e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-16 Martin Liska + + PR ipa/84722 + * gcc.target/i386/mvc10.c: New test. + 2018-03-16 Jakub Jelinek PR c++/79937 diff --git a/gcc/testsuite/gcc.target/i386/mvc10.c b/gcc/testsuite/gcc.target/i386/mvc10.c new file mode 100644 index 00000000000..9a7b609c0b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mvc10.c @@ -0,0 +1,16 @@ +/* PR ipa/84722. */ +/* { dg-do run } */ +/* { dg-require-ifunc "" } */ + +__attribute__ ((target_clones ("avx", "arch=core-avx2", "default"))) int +foo (int i) +{ + return i - 1; +} +int weaks (int i) __attribute__ ((weak, alias ("foo"))); + +int +main (int argc, char **argv) +{ + return weaks (argc); +} -- 2.30.2