From patchwork Wed May 29 19:04:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 1941463 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=SO94QolK; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VqJpR1ZJ8z20Pc for ; Thu, 30 May 2024 05:09:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 65CA5385ED4B for ; Wed, 29 May 2024 19:09:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by sourceware.org (Postfix) with ESMTPS id DB13A385EC56 for ; Wed, 29 May 2024 19:05:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB13A385EC56 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DB13A385EC56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d2f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717009533; cv=none; b=Wspz5FtoZOkYABXNIy8anH+iDBK78laqrMDXDFJ/lSAdpvMc/idhnePrjpQ2qs+WNpt/z7dHDox3EkNffoDBJJZu7tNAs31R4QiOjYBEHk8Rgs5uXhG2PG4luomHweL7b8sOvFCWobZLkq2QK5JJWhxQcj8Jc65rG7r1EGwcFPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717009533; c=relaxed/simple; bh=TutK6BAMIOATcz6J/S9bPsHRU2M4Yk+kZ+eD6wayE5U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=epHTRCZfXDHADj0Y9nBpIwsVvThTY8QGfaW+lfuzQNJXLfIJbMfA6nQRiGIb2SKRNLyjZuAJ2qaOjdy3bWyBzpQWLViOZEXsoAeQp3epQiLPgRl8Pqn9Odp3PJy4U6dQGAgIE36LaboR0L2hru/SALhJ1iaXIOq+NX6zgxOBn9s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7e25bf84b58so1480139f.0 for ; Wed, 29 May 2024 12:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717009524; x=1717614324; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DNPxhV0HgNg7PYgC4NrJJKqnQVOkCV9AbT3u7myn1Ks=; b=SO94QolK8mS7qgU9xSOyaAeWVdLQ4WWaUNfhZ9QG8O53VPO+qYhaNMgk6eeyw/K76S DtipsEja6b9vGhwytOOzc3sm6XSlYdOBZ9lJZW09NvIXt5/Xch99d322b/5vTLug+mD1 6qSEas9dImn6PtCpXefvgMtKVMPQSaE3wGoUR1S04Oja1r2L4Rk1CeEJjhJbu/BHWxxO u3KivGRlwYczZ8C+zTlATjFN7+tH8MW1XkqsioyxOmrJGq4x4I8/KvRBDfNtZQxzjzjS IB8YLTwUZwuA9kyGy491uuUuHimuc8Zn52kBzYeSh4EZmPwlhjHccH8CWJmpjlnV3/OL Jb3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717009524; x=1717614324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DNPxhV0HgNg7PYgC4NrJJKqnQVOkCV9AbT3u7myn1Ks=; b=aYqIdBxAqG+CrSYC83oUoKeT5tFbcXPLWZug3Qs+0PPDCi4CghVhQFx/lsKirpRERh 7p7myQ1gfqZraoOrFZCnfhLJA0zqokkbXWAY4yghWgJ13Aq2OSotV5EYlwviBLoLIzt+ ZTHZj44+vnWBr7KvOE5pU9pOgDSV3slZlxWSlUutnTzq6BHxMmw1eedVil3o4HOawR/f h+dmM0Ijrbiu8MkR2WtEIetLqv20ykPgTFCzGnEX/uBdY25GkI9uxMexIuySvF13ik0U DEUyEEYGbxF6vJ+Ovr7DGIKcOFX8U6VO2V4c2gHH+fxE1zvP3fFaB1iuVbUyD21/yawa EBmg== X-Gm-Message-State: AOJu0YzBlEc114BlZbNkA7mGkvBrS3qXToktcKMhAadBfcC7xN1EpKZv GFDNEF1vYUur8xneiGzh5DU3IQXvDlFa2a6l3a6PFj9xN7UhHgwVkV909YmL4S/dThbHJV6YLqy V X-Google-Smtp-Source: AGHT+IE7LbMW5YCe4/EiXE0TbVw4Z4gGPFXfjhSXWtwdefN2PAfrjpATTHhkPLpWA4nyAsHng0pB6g== X-Received: by 2002:a05:6602:1849:b0:7de:cd91:eb79 with SMTP id ca18e2360f4ac-7e8c4c0ae8cmr1768805339f.6.1717009524277; Wed, 29 May 2024 12:05:24 -0700 (PDT) Received: from pondscum.hsd1.co.comcast.net ([2601:281:d901:5620:9f36:71e9:9cfa:a473]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-7e905ce2c5dsm263392339f.44.2024.05.29.12.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 12:05:23 -0700 (PDT) From: Sandra Loosemore To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com, tburnus@baylibre.com Subject: [PATCH v2 10/12] OpenMP: Remove dead code from declare variant reimplementation Date: Wed, 29 May 2024 13:04:58 -0600 Message-Id: <20240529190500.4097834-11-sloosemore@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240529190500.4097834-1-sloosemore@baylibre.com> References: <20240529190500.4097834-1-sloosemore@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org After reimplementing late resolution of "declare variant" to use the same mechanisms as metadirective, the declare_variant_alt and calls_declare_variant_alt flags on struct cgraph_node are no longer used by anything. For the purposes of marking functions that need late resolution, the has_metadirectives flag has replaced calls_declare_variant_alt. Likewise struct omp_declare_variant_entry, struct omp_declare_variant_base_entry, and the hash tables used to store these structures are no longer needed, since the information needed for late resolution is now stored in the gomp_metadirective nodes. There are no functional changes in this patch, just removing dead code. gcc/ChangeLog * cgraph.cc (symbol_table::create_edge): Don't set calls_declare_variant_alt in the caller. * cgraph.h (struct cgraph_node): Remove declare_variant_alt and calls_declare_variant_alt flags. * cgraphclones.cc (cgraph_node::create_clone): Don't copy calls_declare_variant_alt bit. * ipa-free-lang-data.cc (free_lang_data_in_decl): Adjust code referencing declare_variant_alt bit. * ipa.cc (symbol_table::remove_unreachable_nodes): Likewise. * lto-cgraph.cc (lto_output_node): Remove references to deleted bits. (output_refs): Adjust code referencing declare_variant_alt bit. (input_overwrite_node): Remove references to deleted bits. (input_refs): Adjust code referencing declare_variant_alt bit. * lto-streamer-out.cc (lto_output): Likewise. * lto-streamer.h (omp_lto_output_declare_variant_alt): Delete. (omp_lto_input_declare_variant_alt): Delete. * lto/lto-partition.cc (lto_balanced_map): Adjust code referencing deleted declare_variant_alt bit. * omp-expand.cc (expand_omp_target): Use has_metadirectives bit to trigger pass_omp_device_lower instead of calls_declare_variant_alt. * omp-general.cc (struct omp_declare_variant_entry): Delete. (struct omp_declare_variant_base_entry): Delete. (struct omp_declare_variant_hasher): Delete. (omp_declare_variant_hasher::hash): Delete. (omp_declare_variant_hasher::equal): Delete. (omp_declare_variants): Delete. (omp_declare_variant_alt_hasher): Delete. (omp_declare_variant_alt_hasher::hash): Delete. (omp_declare_variant_alt_hasher::equal): Delete. (omp_declare_variant_alt): Delete. (omp_lto_output_declare_variant_alt): Delete. (omp_lto_input_declare_variant_alt): Delete. (includes): Delete unnecessary include of gt-omp-general.h. * omp-offload.cc (execute_omp_device_lower): Remove references to deleted bit. (pass_omp_device_lower::gate): Likewise. * omp-simd-clone.cc (simd_clone_create): Likewise. * passes.cc (ipa_write_summaries): Likeise. * symtab.cc (symtab_node::get_partitioning_class): Likewise. * tree-inline.cc (expand_call_inline): Likewise. (tree_function_versioning): Likewise. --- gcc/cgraph.cc | 2 - gcc/cgraph.h | 11 +- gcc/cgraphclones.cc | 1 - gcc/ipa-free-lang-data.cc | 2 +- gcc/ipa.cc | 3 - gcc/lto-cgraph.cc | 10 -- gcc/lto-streamer-out.cc | 3 +- gcc/lto-streamer.h | 6 -- gcc/lto/lto-partition.cc | 5 +- gcc/omp-expand.cc | 2 +- gcc/omp-general.cc | 218 -------------------------------------- gcc/omp-offload.cc | 8 +- gcc/omp-simd-clone.cc | 2 - gcc/passes.cc | 3 +- gcc/symtab.cc | 2 +- gcc/tree-inline.cc | 4 - 16 files changed, 10 insertions(+), 272 deletions(-) diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 473d8410bc9..103bc2c0332 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -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 ()) diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 6653ce19c3e..dd210842df7 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -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. */ diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc index e6312b5c0ab..2b16730c10b 100644 --- a/gcc/cgraphclones.cc +++ b/gcc/cgraphclones.cc @@ -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. */ diff --git a/gcc/ipa-free-lang-data.cc b/gcc/ipa-free-lang-data.cc index 3ad203fec4c..dc9f1f58e9e 100644 --- a/gcc/ipa-free-lang-data.cc +++ b/gcc/ipa-free-lang-data.cc @@ -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 { diff --git a/gcc/ipa.cc b/gcc/ipa.cc index c453fca5d9b..c2bf8d42407 100644 --- a/gcc/ipa.cc +++ b/gcc/ipa.cc @@ -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); } diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc index 5bd9916fd2c..a3dc76f219f 100644 --- a/gcc/lto-cgraph.cc +++ b/gcc/lto-cgraph.cc @@ -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 (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 (node)) - if (cnode->declare_variant_alt) - omp_lto_input_declare_variant_alt (ib, cnode, nodes); } } diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc index d4f728094ed..42456d34823 100644 --- a/gcc/lto-streamer-out.cc +++ b/gcc/lto-streamer-out.cc @@ -2815,8 +2815,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 (snode)) && (DECL_INITIAL (vnode->decl) != error_mark_node diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index e8dbba471ed..895aa27692b 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -934,12 +934,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); - /* In options-save.cc. */ void cl_target_option_stream_out (struct output_block *, struct bitpack_d *, struct cl_target_option *); diff --git a/gcc/lto/lto-partition.cc b/gcc/lto/lto-partition.cc index 19f91e5d660..0985631dee0 100644 --- a/gcc/lto/lto-partition.cc +++ b/gcc/lto/lto-partition.cc @@ -593,8 +593,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) @@ -705,7 +704,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) int index; node = dyn_cast (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 diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc index f44ba204123..5abd2240711 100644 --- a/gcc/omp-expand.cc +++ b/gcc/omp-expand.cc @@ -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); diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc index 13cf43d272f..b7eca439ad9 100644 --- a/gcc/omp-general.cc +++ b/gcc/omp-general.cc @@ -2617,222 +2617,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 *variants; -}; - -struct omp_declare_variant_hasher - : ggc_ptr_hash { - 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_variants; - -struct omp_declare_variant_alt_hasher - : ggc_ptr_hash { - 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; - -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 nodes) -{ - gcc_assert (node->declare_variant_alt); - omp_declare_variant_base_entry *entryp - = ggc_cleared_alloc (); - entryp->base = dyn_cast (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 (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::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. */ @@ -4138,5 +3922,3 @@ debug_omp_tokenized_addr (vec &addr_tokens, fputs ("\n", stderr); } - -#include "gt-omp-general.h" diff --git a/gcc/omp-offload.cc b/gcc/omp-offload.cc index c093440bc09..613b77571e6 100644 --- a/gcc/omp-offload.cc +++ b/gcc/omp-offload.cc @@ -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 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 { diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index fa80b6b3bb9..52806620ed0 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -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; } diff --git a/gcc/passes.cc b/gcc/passes.cc index d73f8ba97b6..e9d18b9d22e 100644 --- a/gcc/passes.cc +++ b/gcc/passes.cc @@ -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); diff --git a/gcc/symtab.cc b/gcc/symtab.cc index 3b018ab3ea2..5660857fa51 100644 --- a/gcc/symtab.cc +++ b/gcc/symtab.cc @@ -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. */ diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index cbb1d8e2b23..3db6c3f78db 100644 --- a/gcc/tree-inline.cc +++ b/gcc/tree-inline.cc @@ -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