Commit 43e4df5a by Martin Liska Committed by Martin Liska

Revert behavior to r251316.

2018-02-07  Martin Liska  <mliska@suse.cz>

	PR c++/84059.
	* class.c (add_method): Append argument value.
	* cp-tree.h (maybe_version_functions): Add new argument.
	* decl.c (decls_match): Call it if a declaration does not
	have DECL_FUNCTION_VERSIONED.
	(maybe_version_functions): record argument is added.
2018-02-07  Martin Liska  <mliska@suse.cz>

	PR c++/84059.
	* g++.dg/ext/mv26.C: New test.

From-SVN: r257451
parent 228868f5
2018-02-07 Martin Liska <mliska@suse.cz>
PR c++/84059.
* class.c (add_method): Append argument value.
* cp-tree.h (maybe_version_functions): Add new argument.
* decl.c (decls_match): Call it if a declaration does not
have DECL_FUNCTION_VERSIONED.
(maybe_version_functions): record argument is added.
2018-02-05 Marek Polacek <polacek@redhat.com> 2018-02-05 Marek Polacek <polacek@redhat.com>
* class.c: Remove unused global variables. * class.c: Remove unused global variables.
......
...@@ -1083,7 +1083,7 @@ add_method (tree type, tree method, bool via_using) ...@@ -1083,7 +1083,7 @@ add_method (tree type, tree method, bool via_using)
/* If these are versions of the same function, process and /* If these are versions of the same function, process and
move on. */ move on. */
if (TREE_CODE (fn) == FUNCTION_DECL if (TREE_CODE (fn) == FUNCTION_DECL
&& maybe_version_functions (method, fn)) && maybe_version_functions (method, fn, true))
continue; continue;
if (DECL_INHERITED_CTOR (method)) if (DECL_INHERITED_CTOR (method))
......
...@@ -6135,7 +6135,7 @@ extern bool note_iteration_stmt_body_start (void); ...@@ -6135,7 +6135,7 @@ extern bool note_iteration_stmt_body_start (void);
extern void note_iteration_stmt_body_end (bool); extern void note_iteration_stmt_body_end (bool);
extern tree make_lambda_name (void); extern tree make_lambda_name (void);
extern int decls_match (tree, tree, bool = true); extern int decls_match (tree, tree, bool = true);
extern bool maybe_version_functions (tree, tree); extern bool maybe_version_functions (tree, tree, bool);
extern tree duplicate_decls (tree, tree, bool); extern tree duplicate_decls (tree, tree, bool);
extern tree declare_local_label (tree); extern tree declare_local_label (tree);
extern tree define_label (location_t, tree); extern tree define_label (location_t, tree);
......
...@@ -1087,7 +1087,9 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */) ...@@ -1087,7 +1087,9 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
&& !DECL_EXTERN_C_P (newdecl) && !DECL_EXTERN_C_P (newdecl)
&& !DECL_EXTERN_C_P (olddecl) && !DECL_EXTERN_C_P (olddecl)
&& record_versions && record_versions
&& maybe_version_functions (newdecl, olddecl)) && maybe_version_functions (newdecl, olddecl,
(!DECL_FUNCTION_VERSIONED (newdecl)
|| !DECL_FUNCTION_VERSIONED (olddecl))))
return 0; return 0;
} }
else if (TREE_CODE (newdecl) == TEMPLATE_DECL) else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
...@@ -1145,19 +1147,17 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */) ...@@ -1145,19 +1147,17 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
} }
/* NEWDECL and OLDDECL have identical signatures. If they are /* NEWDECL and OLDDECL have identical signatures. If they are
different versions adjust them and return true. */ different versions adjust them and return true.
If RECORD is set to true, record function versions. */
bool bool
maybe_version_functions (tree newdecl, tree olddecl) maybe_version_functions (tree newdecl, tree olddecl, bool record)
{ {
if (!targetm.target_option.function_versions (newdecl, olddecl)) if (!targetm.target_option.function_versions (newdecl, olddecl))
return false; return false;
bool record = false;
if (!DECL_FUNCTION_VERSIONED (olddecl)) if (!DECL_FUNCTION_VERSIONED (olddecl))
{ {
record = true;
DECL_FUNCTION_VERSIONED (olddecl) = 1; DECL_FUNCTION_VERSIONED (olddecl) = 1;
if (DECL_ASSEMBLER_NAME_SET_P (olddecl)) if (DECL_ASSEMBLER_NAME_SET_P (olddecl))
mangle_decl (olddecl); mangle_decl (olddecl);
...@@ -1165,13 +1165,11 @@ maybe_version_functions (tree newdecl, tree olddecl) ...@@ -1165,13 +1165,11 @@ maybe_version_functions (tree newdecl, tree olddecl)
if (!DECL_FUNCTION_VERSIONED (newdecl)) if (!DECL_FUNCTION_VERSIONED (newdecl))
{ {
record = true;
DECL_FUNCTION_VERSIONED (newdecl) = 1; DECL_FUNCTION_VERSIONED (newdecl) = 1;
if (DECL_ASSEMBLER_NAME_SET_P (newdecl)) if (DECL_ASSEMBLER_NAME_SET_P (newdecl))
mangle_decl (newdecl); mangle_decl (newdecl);
} }
/* Only record if at least one was not already versions. */
if (record) if (record)
cgraph_node::record_function_versions (olddecl, newdecl); cgraph_node::record_function_versions (olddecl, newdecl);
......
2018-02-07 Martin Liska <mliska@suse.cz>
PR c++/84059.
* g++.dg/ext/mv26.C: New test.
2018-02-07 Tom de Vries <tom@codesourcery.com> 2018-02-07 Tom de Vries <tom@codesourcery.com>
* gcc.dg/pr83844.c: Require effective target alloca. * gcc.dg/pr83844.c: Require effective target alloca.
......
// PR c++/84059
// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-require-ifunc "" }
template <typename> struct a
{
int __attribute__ ((target ("arch=ivybridge"))) c (int) {return 1;}
int __attribute__ ((target ("default"))) c (int) { return 2; }
};
void
d ()
{
a<double> b;
b.c (2);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment