diff options
author | Martin Liska <mliska@suse.cz> | 2019-01-18 08:41:05 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-01-18 07:41:05 +0000 |
commit | 5928bc2ec06dd4e7b5bd77a5915eb268f7bd5619 (patch) | |
tree | 955050e3061a8b77e44e226b4d69eb3cde827502 /gcc/multiple_target.c | |
parent | 9c83c58712c72024b893aac5fb0edc597fa583f2 (diff) | |
download | gcc-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/multiple_target.c')
-rw-r--r-- | gcc/multiple_target.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c index 589d059..6126f42 100644 --- a/gcc/multiple_target.c +++ b/gcc/multiple_target.c @@ -294,7 +294,8 @@ create_new_asm_name (char *old_asm_name, char *new_asm_name) /* Creates target clone of NODE. */ static cgraph_node * -create_target_clone (cgraph_node *node, bool definition, char *name) +create_target_clone (cgraph_node *node, bool definition, char *name, + tree attributes) { cgraph_node *new_node; @@ -303,13 +304,16 @@ create_target_clone (cgraph_node *node, bool definition, char *name) new_node = node->create_version_clone_with_body (vNULL, NULL, NULL, false, NULL, NULL, - name); + name, attributes); + if (new_node == NULL) + return NULL; new_node->force_output = true; } else { tree new_decl = copy_node (node->decl); new_node = cgraph_node::get_create (new_decl); + DECL_ATTRIBUTES (new_decl) = attributes; /* Generate a new name for the new version. */ symtab->change_decl_assembler_name (new_node->decl, clone_function_name_numbered ( @@ -400,22 +404,16 @@ expand_target_clones (struct cgraph_node *node, bool definition) create_new_asm_name (attr, suffix); /* Create new target clone. */ - cgraph_node *new_node = create_target_clone (node, definition, suffix); - new_node->local.local = false; - XDELETEVEC (suffix); - - /* Set new attribute for the clone. */ tree attributes = make_attribute ("target", attr, - DECL_ATTRIBUTES (new_node->decl)); - DECL_ATTRIBUTES (new_node->decl) = attributes; - location_t saved_loc = input_location; - input_location = DECL_SOURCE_LOCATION (node->decl); - if (!targetm.target_option.valid_attribute_p (new_node->decl, NULL, - TREE_VALUE (attributes), - 0)) + DECL_ATTRIBUTES (node->decl)); + + cgraph_node *new_node = create_target_clone (node, definition, suffix, + attributes); + if (new_node == NULL) return false; + new_node->local.local = false; + XDELETEVEC (suffix); - input_location = saved_loc; decl2_v = new_node->function_version (); if (decl2_v != NULL) continue; @@ -442,13 +440,7 @@ expand_target_clones (struct cgraph_node *node, bool definition) DECL_ATTRIBUTES (node->decl)); DECL_ATTRIBUTES (node->decl) = attributes; node->local.local = false; - location_t saved_loc = input_location; - input_location = DECL_SOURCE_LOCATION (node->decl); - bool ret - = targetm.target_option.valid_attribute_p (node->decl, NULL, - TREE_VALUE (attributes), 0); - input_location = saved_loc; - return ret; + return true; } /* When NODE is a target clone, consider all callees and redirect |