Properly redirect alias for MVC (PR ipa/84722).
authorMartin Liska <mliska@suse.cz>
Fri, 16 Mar 2018 14:53:24 +0000 (15:53 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 16 Mar 2018 14:53:24 +0000 (14:53 +0000)
2018-03-16  Martin Liska  <mliska@suse.cz>

PR ipa/84722
* multiple_target.c (create_dispatcher_calls): Redirect also
an alias.
2018-03-16  Martin Liska  <mliska@suse.cz>

PR ipa/84722
* gcc.target/i386/mvc10.c: New test.

From-SVN: r258595

gcc/ChangeLog
gcc/multiple_target.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/mvc10.c [new file with mode: 0644]

index 627700ae9bd35a76688b566b1a7582f77aef0eab..96b45d4d2f7550864c87a99dd6c5a1b41110754c 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-16  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/84722
+       * multiple_target.c (create_dispatcher_calls): Redirect also
+       an alias.
+
 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/79937
index a6767985774390298d3dc6ba571e593c147c2072..95297f3cd307eba350e30a1855e2cca9cd3b097d 100644 (file)
@@ -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 ();
        }
index ff2ac8b33bedb34c986afae4ff9a0d4506c1d3de..d4fbd1b94e5b4bd8ee238ef220dbec382ba62643 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-16  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/84722
+       * gcc.target/i386/mvc10.c: New test.
+
 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..9a7b609
--- /dev/null
@@ -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);
+}