@@ -931,8 +931,6 @@ symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee,
caller->decl);
else
edge->in_polymorphic_cdtor = caller->thunk;
- if (callee)
- caller->calls_declare_variant_alt |= callee->declare_variant_alt;
if (callee && symtab->state != LTO_STREAMING
&& edge->callee->comdat_local_p ())
@@ -897,10 +897,8 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
split_part (false), indirect_call_target (false), local (false),
versionable (false), can_change_signature (false),
redefined_extern_inline (false), tm_may_enter_irr (false),
- ipcp_clone (false), declare_variant_alt (false),
- calls_declare_variant_alt (false), gc_candidate (false),
- called_by_ifunc_resolver (false),
- has_metadirectives (false),
+ ipcp_clone (false), gc_candidate (false),
+ called_by_ifunc_resolver (false), has_metadirectives (false),
m_uid (uid), m_summary_id (-1)
{}
@@ -1491,11 +1489,6 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
unsigned tm_may_enter_irr : 1;
/* True if this was a clone created by ipa-cp. */
unsigned ipcp_clone : 1;
- /* True if this is the deferred declare variant resolution artificial
- function. */
- unsigned declare_variant_alt : 1;
- /* True if the function calls declare_variant_alt functions. */
- unsigned calls_declare_variant_alt : 1;
/* True if the function should only be emitted if it is used. This flag
is set for local SIMD clones when they are created and cleared if the
vectorizer uses them. */
@@ -388,7 +388,6 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count,
if (!new_inlined_to)
prof_count = count.combine_with_ipa_count (prof_count);
new_node->count = prof_count;
- new_node->calls_declare_variant_alt = this->calls_declare_variant_alt;
new_node->has_metadirectives = this->has_metadirectives;
/* Update IPA profile. Local profiles need no updating in original. */
@@ -575,7 +575,7 @@ free_lang_data_in_decl (tree decl, class free_lang_data_d *fld)
if (!(node = cgraph_node::get (decl))
|| (!node->definition && !node->clones))
{
- if (node && !node->declare_variant_alt)
+ if (node)
node->release_body ();
else
{
@@ -451,9 +451,6 @@ symbol_table::remove_unreachable_nodes (FILE *file)
reachable.add (body);
reachable.add (e->callee);
}
- else if (e->callee->declare_variant_alt
- && !e->callee->in_other_partition)
- reachable.add (e->callee);
enqueue_node (e->callee, &first, &reachable);
}
@@ -549,8 +549,6 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (&bp, node->merged_extern_inline, 1);
bp_pack_value (&bp, node->thunk, 1);
bp_pack_value (&bp, node->parallelized_function, 1);
- bp_pack_value (&bp, node->declare_variant_alt, 1);
- bp_pack_value (&bp, node->calls_declare_variant_alt, 1);
bp_pack_value (&bp, node->has_metadirectives, 1);
/* Stream thunk info always because we use it in
@@ -781,9 +779,6 @@ output_refs (lto_symtab_encoder_t encoder)
for (int i = 0; node->iterate_reference (i, ref); i++)
lto_output_ref (ob, ref, encoder);
}
- if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
- if (cnode->declare_variant_alt)
- omp_lto_output_declare_variant_alt (ob, cnode, encoder);
}
streamer_write_uhwi_stream (ob->main_stream, 0);
@@ -1251,8 +1246,6 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
node->merged_extern_inline = bp_unpack_value (bp, 1);
node->thunk = bp_unpack_value (bp, 1);
node->parallelized_function = bp_unpack_value (bp, 1);
- node->declare_variant_alt = bp_unpack_value (bp, 1);
- node->calls_declare_variant_alt = bp_unpack_value (bp, 1);
node->has_metadirectives = bp_unpack_value (bp, 1);
*has_thunk_info = bp_unpack_value (bp, 1);
node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
@@ -1663,9 +1656,6 @@ input_refs (class lto_input_block *ib,
input_ref (ib, node, nodes);
count--;
}
- if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
- if (cnode->declare_variant_alt)
- omp_lto_input_declare_variant_alt (ib, cnode, nodes);
}
}
@@ -2808,8 +2808,7 @@ lto_output (void)
&& flag_incremental_link != INCREMENTAL_LINK_LTO)
/* Thunks have no body but they may be synthetized
at WPA time. */
- || DECL_ARGUMENTS (cnode->decl)
- || cnode->declare_variant_alt))
+ || DECL_ARGUMENTS (cnode->decl)))
output_function (cnode);
else if ((vnode = dyn_cast <varpool_node *> (snode))
&& (DECL_INITIAL (vnode->decl) != error_mark_node
@@ -930,12 +930,6 @@ bool reachable_from_this_partition_p (struct cgraph_node *,
lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
void select_what_to_stream (void);
-/* In omp-general.cc. */
-void omp_lto_output_declare_variant_alt (lto_simple_output_block *,
- cgraph_node *, lto_symtab_encoder_t);
-void omp_lto_input_declare_variant_alt (lto_input_block *, cgraph_node *,
- vec<symtab_node *>);
-
/* In options-save.cc. */
void cl_target_option_stream_out (struct output_block *, struct bitpack_d *,
struct cl_target_option *);
@@ -1180,8 +1180,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
last_visited_node++;
- gcc_assert (node->definition || node->weakref
- || node->declare_variant_alt);
+ gcc_assert (node->definition || node->weakref);
/* Compute boundary cost of callgraph edges. */
for (edge = node->callees; edge; edge = edge->next_callee)
@@ -1292,7 +1291,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
int index;
node = dyn_cast <cgraph_node *> (ref->referring);
- gcc_assert (node->definition || node->declare_variant_alt);
+ gcc_assert (node->definition);
index = lto_symtab_encoder_lookup (partition->encoder,
node);
if (index != LCC_NOT_FOUND
@@ -10109,7 +10109,7 @@ expand_omp_target (struct omp_region *region)
/* Enable pass_omp_device_lower pass. */
fn2_node = cgraph_node::get (DECL_CONTEXT (child_fn));
- fn2_node->calls_declare_variant_alt = 1;
+ fn2_node->has_metadirectives = 1;
t = build_decl (DECL_SOURCE_LOCATION (child_fn),
RESULT_DECL, NULL_TREE, void_type_node);
@@ -2639,222 +2639,6 @@ omp_complete_construct_context (tree construct_context, bool *completep)
return construct_context;
}
-/* Class describing a single variant. */
-struct GTY(()) omp_declare_variant_entry {
- /* NODE of the variant. */
- cgraph_node *variant;
- /* Score if not in declare simd clone. */
- score_wide_int score;
- /* Score if in declare simd clone. */
- score_wide_int score_in_declare_simd_clone;
- /* Context selector for the variant. */
- tree ctx;
- /* True if the context selector is known to match already. */
- bool matches;
-};
-
-/* Class describing a function with variants. */
-struct GTY((for_user)) omp_declare_variant_base_entry {
- /* NODE of the base function. */
- cgraph_node *base;
- /* NODE of the artificial function created for the deferred variant
- resolution. */
- cgraph_node *node;
- /* Vector of the variants. */
- vec<omp_declare_variant_entry, va_gc> *variants;
-};
-
-struct omp_declare_variant_hasher
- : ggc_ptr_hash<omp_declare_variant_base_entry> {
- static hashval_t hash (omp_declare_variant_base_entry *);
- static bool equal (omp_declare_variant_base_entry *,
- omp_declare_variant_base_entry *);
-};
-
-hashval_t
-omp_declare_variant_hasher::hash (omp_declare_variant_base_entry *x)
-{
- inchash::hash hstate;
- hstate.add_int (DECL_UID (x->base->decl));
- hstate.add_int (x->variants->length ());
- omp_declare_variant_entry *variant;
- unsigned int i;
- FOR_EACH_VEC_SAFE_ELT (x->variants, i, variant)
- {
- hstate.add_int (DECL_UID (variant->variant->decl));
- hstate.add_wide_int (variant->score);
- hstate.add_wide_int (variant->score_in_declare_simd_clone);
- hstate.add_ptr (variant->ctx);
- hstate.add_int (variant->matches);
- }
- return hstate.end ();
-}
-
-bool
-omp_declare_variant_hasher::equal (omp_declare_variant_base_entry *x,
- omp_declare_variant_base_entry *y)
-{
- if (x->base != y->base
- || x->variants->length () != y->variants->length ())
- return false;
- omp_declare_variant_entry *variant;
- unsigned int i;
- FOR_EACH_VEC_SAFE_ELT (x->variants, i, variant)
- if (variant->variant != (*y->variants)[i].variant
- || variant->score != (*y->variants)[i].score
- || (variant->score_in_declare_simd_clone
- != (*y->variants)[i].score_in_declare_simd_clone)
- || variant->ctx != (*y->variants)[i].ctx
- || variant->matches != (*y->variants)[i].matches)
- return false;
- return true;
-}
-
-static GTY(()) hash_table<omp_declare_variant_hasher> *omp_declare_variants;
-
-struct omp_declare_variant_alt_hasher
- : ggc_ptr_hash<omp_declare_variant_base_entry> {
- static hashval_t hash (omp_declare_variant_base_entry *);
- static bool equal (omp_declare_variant_base_entry *,
- omp_declare_variant_base_entry *);
-};
-
-hashval_t
-omp_declare_variant_alt_hasher::hash (omp_declare_variant_base_entry *x)
-{
- return DECL_UID (x->node->decl);
-}
-
-bool
-omp_declare_variant_alt_hasher::equal (omp_declare_variant_base_entry *x,
- omp_declare_variant_base_entry *y)
-{
- return x->node == y->node;
-}
-
-static GTY(()) hash_table<omp_declare_variant_alt_hasher>
- *omp_declare_variant_alt;
-
-void
-omp_lto_output_declare_variant_alt (lto_simple_output_block *ob,
- cgraph_node *node,
- lto_symtab_encoder_t encoder)
-{
- gcc_assert (node->declare_variant_alt);
-
- omp_declare_variant_base_entry entry;
- entry.base = NULL;
- entry.node = node;
- entry.variants = NULL;
- omp_declare_variant_base_entry *entryp
- = omp_declare_variant_alt->find_with_hash (&entry, DECL_UID (node->decl));
- gcc_assert (entryp);
-
- int nbase = lto_symtab_encoder_lookup (encoder, entryp->base);
- gcc_assert (nbase != LCC_NOT_FOUND);
- streamer_write_hwi_stream (ob->main_stream, nbase);
-
- streamer_write_hwi_stream (ob->main_stream, entryp->variants->length ());
-
- unsigned int i;
- omp_declare_variant_entry *varentry;
- FOR_EACH_VEC_SAFE_ELT (entryp->variants, i, varentry)
- {
- int nvar = lto_symtab_encoder_lookup (encoder, varentry->variant);
- gcc_assert (nvar != LCC_NOT_FOUND);
- streamer_write_hwi_stream (ob->main_stream, nvar);
-
- for (score_wide_int *w = &varentry->score; ;
- w = &varentry->score_in_declare_simd_clone)
- {
- unsigned len = w->get_len ();
- streamer_write_hwi_stream (ob->main_stream, len);
- const HOST_WIDE_INT *val = w->get_val ();
- for (unsigned j = 0; j < len; j++)
- streamer_write_hwi_stream (ob->main_stream, val[j]);
- if (w == &varentry->score_in_declare_simd_clone)
- break;
- }
-
- HOST_WIDE_INT cnt = -1;
- HOST_WIDE_INT i = varentry->matches ? 1 : 0;
- for (tree attr = DECL_ATTRIBUTES (entryp->base->decl);
- attr; attr = TREE_CHAIN (attr), i += 2)
- {
- attr = lookup_attribute ("omp declare variant base", attr);
- if (attr == NULL_TREE)
- break;
-
- if (varentry->ctx == TREE_VALUE (TREE_VALUE (attr)))
- {
- cnt = i;
- break;
- }
- }
-
- gcc_assert (cnt != -1);
- streamer_write_hwi_stream (ob->main_stream, cnt);
- }
-}
-
-void
-omp_lto_input_declare_variant_alt (lto_input_block *ib, cgraph_node *node,
- vec<symtab_node *> nodes)
-{
- gcc_assert (node->declare_variant_alt);
- omp_declare_variant_base_entry *entryp
- = ggc_cleared_alloc<omp_declare_variant_base_entry> ();
- entryp->base = dyn_cast<cgraph_node *> (nodes[streamer_read_hwi (ib)]);
- entryp->node = node;
- unsigned int len = streamer_read_hwi (ib);
- vec_alloc (entryp->variants, len);
-
- for (unsigned int i = 0; i < len; i++)
- {
- omp_declare_variant_entry varentry;
- varentry.variant
- = dyn_cast<cgraph_node *> (nodes[streamer_read_hwi (ib)]);
- for (score_wide_int *w = &varentry.score; ;
- w = &varentry.score_in_declare_simd_clone)
- {
- unsigned len2 = streamer_read_hwi (ib);
- HOST_WIDE_INT arr[WIDE_INT_MAX_HWIS (1024)];
- gcc_assert (len2 <= WIDE_INT_MAX_HWIS (1024));
- for (unsigned int j = 0; j < len2; j++)
- arr[j] = streamer_read_hwi (ib);
- *w = score_wide_int::from_array (arr, len2, true);
- if (w == &varentry.score_in_declare_simd_clone)
- break;
- }
-
- HOST_WIDE_INT cnt = streamer_read_hwi (ib);
- HOST_WIDE_INT j = 0;
- varentry.ctx = NULL_TREE;
- varentry.matches = (cnt & 1) ? true : false;
- cnt &= ~HOST_WIDE_INT_1;
- for (tree attr = DECL_ATTRIBUTES (entryp->base->decl);
- attr; attr = TREE_CHAIN (attr), j += 2)
- {
- attr = lookup_attribute ("omp declare variant base", attr);
- if (attr == NULL_TREE)
- break;
-
- if (cnt == j)
- {
- varentry.ctx = TREE_VALUE (TREE_VALUE (attr));
- break;
- }
- }
- gcc_assert (varentry.ctx != NULL_TREE);
- entryp->variants->quick_push (varentry);
- }
- if (omp_declare_variant_alt == NULL)
- omp_declare_variant_alt
- = hash_table<omp_declare_variant_alt_hasher>::create_ggc (64);
- *omp_declare_variant_alt->find_slot_with_hash (entryp, DECL_UID (node->decl),
- INSERT) = entryp;
-}
-
/* Comparison function for sorting routines, to sort OpenMP metadirective
variants by decreasing score. */
@@ -4636,4 +4420,3 @@ omp_maybe_apply_loop_xforms (tree *expr_p, tree for_clauses)
}
}
-#include "gt-omp-general.h"
@@ -2718,8 +2718,6 @@ execute_omp_device_lower ()
bool regimplify = false;
basic_block bb;
gimple_stmt_iterator gsi;
- bool calls_declare_variant_alt
- = cgraph_node::get (cfun->decl)->calls_declare_variant_alt;
auto_vec<basic_block> metadirective_bbs;
#ifdef ACCEL_COMPILER
bool omp_redirect_indirect_calls = vec_safe_length (offload_ind_funcs) > 0;
@@ -2736,8 +2734,6 @@ execute_omp_device_lower ()
continue;
if (!gimple_call_internal_p (stmt))
{
- /* FIXME: this is a leftover of obsolete code. */
- gcc_assert (!calls_declare_variant_alt);
#ifdef ACCEL_COMPILER
if (omp_redirect_indirect_calls
&& gimple_call_fndecl (stmt) == NULL_TREE)
@@ -2919,9 +2915,7 @@ public:
#endif
return (!(fun->curr_properties & PROP_gimple_lomp_dev)
|| (flag_openmp
- && (node->calls_declare_variant_alt
- || node->has_metadirectives
- || offload_ind_funcs_p)));
+ && (node->has_metadirectives || offload_ind_funcs_p)));
}
unsigned int execute (function *) final override
{
@@ -688,8 +688,6 @@ simd_clone_create (struct cgraph_node *old_node, bool force_local)
the old node. */
new_node->local = old_node->local;
new_node->externally_visible = old_node->externally_visible;
- new_node->calls_declare_variant_alt
- = old_node->calls_declare_variant_alt;
new_node->has_metadirectives = old_node->has_metadirectives;
}
@@ -2881,8 +2881,7 @@ ipa_write_summaries (void)
{
struct cgraph_node *node = order[i];
- if ((node->definition || node->declare_variant_alt)
- && node->need_lto_streaming)
+ if (node->definition && node->need_lto_streaming)
{
if (gimple_has_body_p (node->decl))
lto_prepare_function_for_streaming (node);
@@ -2160,7 +2160,7 @@ symtab_node::get_partitioning_class (void)
if (DECL_ABSTRACT_P (decl))
return SYMBOL_EXTERNAL;
- if (cnode && (cnode->inlined_to || cnode->declare_variant_alt))
+ if (cnode && cnode->inlined_to)
return SYMBOL_DUPLICATE;
/* Transparent aliases are always duplicated. */
@@ -5073,8 +5073,6 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
if (src_properties != prop_mask)
dst_cfun->curr_properties &= src_properties | ~prop_mask;
dst_cfun->calls_eh_return |= id->src_cfun->calls_eh_return;
- id->dst_node->calls_declare_variant_alt
- |= id->src_node->calls_declare_variant_alt;
id->dst_node->has_metadirectives |= id->src_node->has_metadirectives;
gcc_assert (!id->src_cfun->after_inlining);
@@ -6362,8 +6360,6 @@ tree_function_versioning (tree old_decl, tree new_decl,
DECL_ARGUMENTS (new_decl) = DECL_ARGUMENTS (old_decl);
initialize_cfun (new_decl, old_decl,
new_entry ? new_entry->count : old_entry_block->count);
- new_version_node->calls_declare_variant_alt
- = old_version_node->calls_declare_variant_alt;
new_version_node->has_metadirectives = old_version_node->has_metadirectives;
if (DECL_STRUCT_FUNCTION (new_decl)->gimple_df)
DECL_STRUCT_FUNCTION (new_decl)->gimple_df->ipa_pta