public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/trunk] Use auto_vec in ssa_equiv_stack. Date: Thu, 10 Jun 2021 15:03:38 +0000 (GMT) [thread overview] Message-ID: <20210610150338.6583C3864858@sourceware.org> (raw) https://gcc.gnu.org/g:04a040d907a83af54e0a98bdba5bfabc0ef4f700 commit 04a040d907a83af54e0a98bdba5bfabc0ef4f700 Author: Aldy Hernandez <aldyh@redhat.com> Date: Thu Jun 10 09:20:30 2021 +0200 Use auto_vec in ssa_equiv_stack. There is a mismatch between the new and the delete for the ssa_equiv_stack class. The correct idiom should have been delete[]. It has been pointed out that perhaps a better alternative is to use an auto_vec which does everything automatically. Plus, it is more consistent with m_stack which is already an auto_vec. This patch fixes the issue in PR100984. Tested on x86-64 Linux. gcc/ChangeLog: PR tree-optimization/100984 * gimple-ssa-evrp.c (ssa_equiv_stack): Use auto_vec for replacements table. (ssa_equiv_stack::~ssa_equiv_stack): Remove. Diff: --- gcc/gimple-ssa-evrp.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c index 7e1cf51239a..eb8320ae9d8 100644 --- a/gcc/gimple-ssa-evrp.c +++ b/gcc/gimple-ssa-evrp.c @@ -53,7 +53,6 @@ class ssa_equiv_stack { public: ssa_equiv_stack (); - ~ssa_equiv_stack (); void enter (basic_block); void leave (basic_block); void push_replacement (tree name, tree replacement); @@ -61,19 +60,13 @@ public: private: auto_vec<std::pair <tree, tree>> m_stack; - tree *m_replacements; + auto_vec<tree> m_replacements; const std::pair <tree, tree> m_marker = std::make_pair (NULL, NULL); }; ssa_equiv_stack::ssa_equiv_stack () { - m_replacements = new tree[num_ssa_names] (); -} - -ssa_equiv_stack::~ssa_equiv_stack () -{ - m_stack.release (); - delete m_replacements; + m_replacements.safe_grow_cleared (num_ssa_names); } // Pushes a marker at the given point.
reply other threads:[~2021-06-10 15:03 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=20210610150338.6583C3864858@sourceware.org \ --to=aldyh@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).