aboutsummaryrefslogtreecommitdiff
path: root/gcc/multiple_target.c
diff options
context:
space:
mode:
authorYichao Yu <yyc1992@gmail.com>2020-06-26 15:46:15 -0600
committerJeff Law <law@redhat.com>2020-06-26 15:49:52 -0600
commit00e90d3d4cb51fd0fae7b2dbd4bab1db26d6676e (patch)
treeb4822e4fbc21194590e4ecb26d9f5c0b31c6d29d /gcc/multiple_target.c
parent67161d24f45601e43abea98f2c3d7d7a462b6eab (diff)
downloadgcc-00e90d3d4cb51fd0fae7b2dbd4bab1db26d6676e.zip
gcc-00e90d3d4cb51fd0fae7b2dbd4bab1db26d6676e.tar.gz
gcc-00e90d3d4cb51fd0fae7b2dbd4bab1db26d6676e.tar.bz2
Fix target clone indirection elimination
The current logic seems to be comparing the whole attribute tree between the callee and caller (or at least the tree starting from the target attribute). This is unnecessary and causes strange dependency of the indirection elimination on unrelated properties like `noinline`(PR95780) and `visibility`(PR95778). This changes the comparison to be only on the `target` attribute which should be the intent of the code. gcc * multiple_target.c (redirect_to_specific_clone): Fix tests to check individual attribute rather than an attribute list. gcc/testsuite * gcc.target/i386/pr95778-1.c: New test. * gcc.target/i386/pr95778-2.c: New test.
Diffstat (limited to 'gcc/multiple_target.c')
-rw-r--r--gcc/multiple_target.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c
index c1cfe8f..b15d004 100644
--- a/gcc/multiple_target.c
+++ b/gcc/multiple_target.c
@@ -483,7 +483,8 @@ redirect_to_specific_clone (cgraph_node *node)
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;
@@ -494,7 +495,8 @@ redirect_to_specific_clone (cgraph_node *node)
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);