DECL_ATTRIBUTES (e->callee->decl));
/* Function is not calling proper target clone. */
- if (!attribute_list_equal (attr_target, attr_target2))
+ if (attr_target2 == NULL_TREE
+ || !attribute_value_equal (attr_target, attr_target2))
{
while (fv2->prev != NULL)
fv2 = fv2->prev;
cgraph_node *callee = fv2->this_node;
attr_target2 = lookup_attribute ("target",
DECL_ATTRIBUTES (callee->decl));
- if (attribute_list_equal (attr_target, attr_target2))
+ if (attr_target2 != NULL_TREE
+ && attribute_value_equal (attr_target, attr_target2))
{
e->redirect_callee (callee);
cgraph_edge::redirect_call_stmt_to_callee (e);
--- /dev/null
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O3 -fPIC -fno-asynchronous-unwind-tables" } */
+/* { dg-require-ifunc "" } */
+
+__attribute__((target_clones("default,avx2")))
+static int
+f2(int *p)
+{
+ asm volatile ("" :: "r"(p) : "memory");
+ return *p;
+}
+
+__attribute__((target_clones("default,avx2")))
+int
+g2(int *p)
+{
+ return f2(p);
+}
+
+/* { dg-final { scan-assembler "g2.default.1:\n\tjmp\tf2.default.1\n" } } */
+/* { dg-final { scan-assembler "g2.avx2.0:\n\tjmp\tf2.avx2.0\n" } } */
--- /dev/null
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O3 -fPIC -fno-asynchronous-unwind-tables" } */
+/* { dg-require-ifunc "" } */
+
+__attribute__((visibility("internal"),target_clones("default,avx2")))
+int
+f2(int *p)
+{
+ asm volatile ("" :: "r"(p) : "memory");
+ return *p;
+}
+
+__attribute__((target_clones("default,avx2")))
+int
+g2(int *p)
+{
+ return f2(p);
+}
+
+/* { dg-final { scan-assembler "g2.default.1:\n\tjmp\tf2.default.1\n" } } */
+/* { dg-final { scan-assembler "g2.avx2.0:\n\tjmp\tf2.avx2.0\n" } } */