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
This commit is contained in:
Martin Liska 2018-02-07 14:16:04 +01:00 committed by Martin Liska
parent 228868f532
commit 43e4df5a0b
6 changed files with 37 additions and 10 deletions

View File

@ -1,3 +1,12 @@
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>
* class.c: Remove unused global variables.

View File

@ -1083,7 +1083,7 @@ add_method (tree type, tree method, bool via_using)
/* If these are versions of the same function, process and
move on. */
if (TREE_CODE (fn) == FUNCTION_DECL
&& maybe_version_functions (method, fn))
&& maybe_version_functions (method, fn, true))
continue;
if (DECL_INHERITED_CTOR (method))

View File

@ -6135,7 +6135,7 @@ extern bool note_iteration_stmt_body_start (void);
extern void note_iteration_stmt_body_end (bool);
extern tree make_lambda_name (void);
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 declare_local_label (tree);
extern tree define_label (location_t, tree);

View File

@ -1087,7 +1087,9 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
&& !DECL_EXTERN_C_P (newdecl)
&& !DECL_EXTERN_C_P (olddecl)
&& record_versions
&& maybe_version_functions (newdecl, olddecl))
&& maybe_version_functions (newdecl, olddecl,
(!DECL_FUNCTION_VERSIONED (newdecl)
|| !DECL_FUNCTION_VERSIONED (olddecl))))
return 0;
}
else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
@ -1145,19 +1147,17 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
}
/* 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
maybe_version_functions (tree newdecl, tree olddecl)
maybe_version_functions (tree newdecl, tree olddecl, bool record)
{
if (!targetm.target_option.function_versions (newdecl, olddecl))
return false;
bool record = false;
if (!DECL_FUNCTION_VERSIONED (olddecl))
{
record = true;
DECL_FUNCTION_VERSIONED (olddecl) = 1;
if (DECL_ASSEMBLER_NAME_SET_P (olddecl))
mangle_decl (olddecl);
@ -1165,13 +1165,11 @@ maybe_version_functions (tree newdecl, tree olddecl)
if (!DECL_FUNCTION_VERSIONED (newdecl))
{
record = true;
DECL_FUNCTION_VERSIONED (newdecl) = 1;
if (DECL_ASSEMBLER_NAME_SET_P (newdecl))
mangle_decl (newdecl);
}
/* Only record if at least one was not already versions. */
if (record)
cgraph_node::record_function_versions (olddecl, newdecl);

View File

@ -1,3 +1,8 @@
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>
* gcc.dg/pr83844.c: Require effective target alloca.

View File

@ -0,0 +1,15 @@
// 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);
}