From: David Malcolm <dmalcolm@redhat.com>
To: jit@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [jit] Clean out state within ipa-cp.c
Date: Wed, 01 Jan 2014 00:00:00 -0000 [thread overview]
Message-ID: <1405363189-6240-1-git-send-email-dmalcolm@redhat.com> (raw)
Committed to branch dmalcolm/jit:
Certain client code that repeatedly performed in-process compilations with
optimizations and inlinable functions led to a segfault within
ipa-cp.c:propagate_effects, whilst traversing the values_topo list.
The root cause was that values_topo was not reset to NULL, and hence could
contain entities allocated by a previous compile within a then-defunct
alloc_pool.
Introduce ipa_cp_c_finalize to clean out state within ipa-cp.c and call
it from toplev::finalize. In particular, reset values_topo back to NULL.
gcc/
* cgraph.h (ipa_cp_c_finalize): Add prototype.
* ipa-cp.c (ipa_cp_c_finalize): New.
* toplev.c (toplev::finalize): Add call to ipa_cp_c_finalize.
---
gcc/ChangeLog.jit | 6 ++++++
gcc/cgraph.h | 2 ++
gcc/ipa-cp.c | 9 +++++++++
gcc/toplev.c | 1 +
4 files changed, 18 insertions(+)
diff --git a/gcc/ChangeLog.jit b/gcc/ChangeLog.jit
index f8235f1..3a6ea52 100644
--- a/gcc/ChangeLog.jit
+++ b/gcc/ChangeLog.jit
@@ -1,3 +1,9 @@
+2014-07-14 David Malcolm <dmalcolm@redhat.com>
+
+ * cgraph.h (ipa_cp_c_finalize): Add prototype.
+ * ipa-cp.c (ipa_cp_c_finalize): New.
+ * toplev.c (toplev::finalize): Add call to ipa_cp_c_finalize.
+
2014-05-08 David Malcolm <dmalcolm@redhat.com>
* params.c (global_init_params): Require that params_finished be
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 2e2eb97..2d7e574 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -866,6 +866,8 @@ void symtab_initialize_asm_name_hash (void);
void symtab_prevail_in_asm_name_hash (symtab_node node);
void varpool_remove_initializer (struct varpool_node *);
+/* In ipa-cp.c */
+void ipa_cp_c_finalize (void);
/* Return callgraph node for given symbol and check it is a function. */
static inline struct cgraph_node *
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 57ec2db..39650f0 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3689,3 +3689,12 @@ make_pass_ipa_cp (gcc::context *ctxt)
{
return new pass_ipa_cp (ctxt);
}
+
+void
+ipa_cp_c_finalize (void)
+{
+ max_count = 0;
+ overall_size = 0;
+ max_new_size = 0;
+ values_topo = NULL;
+}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 5123dbe..8fa92c5 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2014,6 +2014,7 @@ toplev::finalize (void)
dwarf2out_c_finalize ();
gcse_c_finalize ();
ipa_c_finalize ();
+ ipa_cp_c_finalize ();
ipa_reference_c_finalize ();
params_c_finalize ();
predict_c_finalize ();
--
1.8.5.3
reply other threads:[~2014-07-14 18:35 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=1405363189-6240-1-git-send-email-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jit@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: link
Be 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).