aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphclones.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-01-18 08:41:05 +0100
committerMartin Liska <marxin@gcc.gnu.org>2019-01-18 07:41:05 +0000
commit5928bc2ec06dd4e7b5bd77a5915eb268f7bd5619 (patch)
tree955050e3061a8b77e44e226b4d69eb3cde827502 /gcc/cgraphclones.c
parent9c83c58712c72024b893aac5fb0edc597fa583f2 (diff)
downloadgcc-5928bc2ec06dd4e7b5bd77a5915eb268f7bd5619.zip
gcc-5928bc2ec06dd4e7b5bd77a5915eb268f7bd5619.tar.gz
gcc-5928bc2ec06dd4e7b5bd77a5915eb268f7bd5619.tar.bz2
Reset proper type on vector types (PR middle-end/88587).
2019-01-18 Martin Liska <mliska@suse.cz> Richard Biener <rguenther@suse.de> PR middle-end/88587 * cgraph.h (create_version_clone_with_body): Add new argument with attributes. * cgraphclones.c (cgraph_node::create_version_clone): Add DECL_ATTRIBUTES to a newly created decl. And call valid_attribute_p so that proper cl_target_optimization_node is set for the newly created declaration. * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES for declaration. (expand_target_clones): Do not call valid_attribute_p, it must be already done. * tree-inline.c (copy_decl_for_dup_finish): Reset mode for vector types. 2019-01-18 Martin Liska <mliska@suse.cz> PR middle-end/88587 * g++.target/i386/pr88587.C: New test. * gcc.target/i386/mvc13.c: New test. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r268060
Diffstat (limited to 'gcc/cgraphclones.c')
-rw-r--r--gcc/cgraphclones.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 4688de9..15f7e11 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -1012,6 +1012,11 @@ cgraph_node::create_version_clone (tree new_decl,
If non-NULL BLOCK_TO_COPY determine what basic blocks to copy.
If non_NULL NEW_ENTRY determine new entry BB of the clone.
+ If TARGET_ATTRIBUTES is non-null, when creating a new declaration,
+ add the attributes to DECL_ATTRIBUTES. And call valid_attribute_p
+ that will promote value of the attribute DECL_FUNCTION_SPECIFIC_TARGET
+ of the declaration.
+
Return the new version's cgraph node. */
cgraph_node *
@@ -1019,7 +1024,7 @@ cgraph_node::create_version_clone_with_body
(vec<cgraph_edge *> redirect_callers,
vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip,
bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block,
- const char *suffix)
+ const char *suffix, tree target_attributes)
{
tree old_decl = decl;
cgraph_node *new_version_node = NULL;
@@ -1044,6 +1049,19 @@ cgraph_node::create_version_clone_with_body
DECL_VIRTUAL_P (new_decl) = 0;
+ if (target_attributes)
+ {
+ DECL_ATTRIBUTES (new_decl) = target_attributes;
+
+ location_t saved_loc = input_location;
+ tree v = TREE_VALUE (target_attributes);
+ input_location = DECL_SOURCE_LOCATION (new_decl);
+ bool r = targetm.target_option.valid_attribute_p (new_decl, NULL, v, 0);
+ input_location = saved_loc;
+ if (!r)
+ return NULL;
+ }
+
/* When the old decl was a con-/destructor make sure the clone isn't. */
DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
DECL_STATIC_DESTRUCTOR (new_decl) = 0;