public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/c++-modules] Replace std::vector<> usage in ipa-fnsummary.c with GCC's vec<>. Date: Thu, 27 Aug 2020 18:07:24 +0000 (GMT) [thread overview] Message-ID: <20200827180724.D528538708B7@sourceware.org> (raw) https://gcc.gnu.org/g:82c4b78dbef6f03838e3040688c934360a09513f commit 82c4b78dbef6f03838e3040688c934360a09513f Author: Aldy Hernandez <aldyh@redhat.com> Date: Thu Aug 6 15:32:28 2020 +0200 Replace std::vector<> usage in ipa-fnsummary.c with GCC's vec<>. gcc/ChangeLog: * ipa-fnsummary.c (evaluate_conditions_for_known_args): Use vec<> instead of std::vector<>. (evaluate_properties_for_edge): Same. (ipa_fn_summary_t::duplicate): Same. (estimate_ipcp_clone_size_and_time): Same. * vec.h (<T, A, vl_embed>::embedded_size): Change vec_embedded type to contain a char[]. Diff: --- gcc/ipa-fnsummary.c | 17 ++++++++--------- gcc/vec.h | 5 ++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index 59e52927151..2cfab40156e 100644 --- a/gcc/ipa-fnsummary.c +++ b/gcc/ipa-fnsummary.c @@ -331,7 +331,7 @@ static void evaluate_conditions_for_known_args (struct cgraph_node *node, bool inline_p, vec<tree> known_vals, - const std::vector<value_range> &known_value_ranges, + vec<value_range> known_value_ranges, vec<ipa_agg_value_set> known_aggs, clause_t *ret_clause, clause_t *ret_nonspec_clause) @@ -446,7 +446,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, continue; } } - if (c->operand_num < (int) known_value_ranges.size () + if (c->operand_num < (int) known_value_ranges.length () && !c->agg_contents && !known_value_ranges[c->operand_num].undefined_p () && !known_value_ranges[c->operand_num].varying_p () @@ -555,7 +555,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, { struct cgraph_node *callee = e->callee->ultimate_alias_target (); class ipa_fn_summary *info = ipa_fn_summaries->get (callee); - std::vector<value_range> known_value_ranges (32); + auto_vec<value_range, 32> known_value_ranges; class ipa_edge_args *args; if (clause_ptr) @@ -630,11 +630,11 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, i)); if (!vr.undefined_p () && !vr.varying_p ()) { - if (!known_value_ranges.size ()) + if (!known_value_ranges.length ()) { - known_value_ranges.resize (count); + known_value_ranges.safe_grow (count); for (int i = 0; i < count; ++i) - known_value_ranges[i].set_undefined (); + new (&known_value_ranges[i]) value_range (); } known_value_ranges[i] = vr; } @@ -808,7 +808,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, } evaluate_conditions_for_known_args (dst, false, known_vals, - std::vector<value_range> (), + vNULL, vNULL, &possible_truths, /* We are going to specialize, @@ -3692,8 +3692,7 @@ estimate_ipcp_clone_size_and_time (struct cgraph_node *node, clause_t clause, nonspec_clause; /* TODO: Also pass known value ranges. */ - evaluate_conditions_for_known_args (node, false, known_vals, - std::vector<value_range> (), + evaluate_conditions_for_known_args (node, false, known_vals, vNULL, known_aggs, &clause, &nonspec_clause); ipa_call_context ctx (node, clause, nonspec_clause, known_vals, known_contexts, diff --git a/gcc/vec.h b/gcc/vec.h index 3ad99b83690..db48e979d77 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -1281,7 +1281,10 @@ template<typename T, typename A> inline size_t vec<T, A, vl_embed>::embedded_size (unsigned alloc) { - typedef vec<T, A, vl_embed> vec_embedded; + struct alignas (T) U { char data[sizeof (T)]; }; + typedef vec<U, A, vl_embed> vec_embedded; + static_assert (sizeof (vec_embedded) == sizeof(vec), ""); + static_assert (alignof (vec_embedded) == alignof(vec), ""); return offsetof (vec_embedded, m_vecdata) + alloc * sizeof (T); }
reply other threads:[~2020-08-27 18:07 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200827180724.D528538708B7@sourceware.org \ --to=nathan@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).