diff mbox

[PR,79198] Call ipa-prop func summary destructor

Message ID 20170124095758.ihwxllhunl4626er@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Jan. 24, 2017, 9:57 a.m. UTC
Hi,

the first of the following two patches fixes PR 79198.  The issue is
that early inliner creates ipa_node_params_sum then and calls
ipa_free_all_node_params to release it many times (I guess for each
function) and because I forgot to call the destructor in the function,
we ended up with multitudes of simultaneously active duplication
cgraph hooks and each invocation doubled the vectors it was written to
copy.

Calling the destructor avoids this because it de-registers the hooks.
In the next stage1 we should figure out why early inliner needs the
summary and avoid it.

One thing that troubles me is that if I attempt to ggc_free
ipa_node_params_sum after calling the destructor, I end up with random
segfault later on in the compilation.  I will try to investigate a bit
more but I do not have a very good comprehension of how GC and C++
classes mix.

The second patch is not necessary to restore profiledbootstrap and
bootstrap on many platforms, but when I looked at the code, I was
afraid the two fields might not be initialized correctly, so I'd like
to commit it to trunk too.

Both patches have survived bootstrap, lto bootstrap and testing on
x86_64 and bootstrap on i686.  On IRC, Markus and David confirmed the
first patches fixes the issue for them too.  Because of that and
because the fix is rather simple, I am going to commit both patches as
obvious.

Thanks and sorry for the breakage,

Martin

[PR 79198] Call ipa-prop func summary destructor

2017-01-23  Martin Jambor  <mjambor@suse.cz>

	PR bootstrap/79198
	* ipa-prop.c (ipa_free_all_node_params): Call summary destructor.
---
 gcc/ipa-prop.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 512bcbed0cb..22cd61f3b18 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -3574,6 +3574,7 @@  ipa_free_all_edge_args (void)
 void
 ipa_free_all_node_params (void)
 {
+  ipa_node_params_sum->~ipa_node_params_t ();
   ipa_node_params_sum = NULL;
 }
 
-- 
2.11.0

[PR 79198] Init vectors in ipa_node_params_t::insert

2017-01-23  Martin Jambor  <mjambor@suse.cz>

	PR bootstrap/79198
	* ipa-prop.c (insert): Initialize fields known_csts and
	known_contexts.
---
 gcc/ipa-prop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 22cd61f3b18..834c27d100e 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -3743,6 +3743,8 @@  ipa_node_params_t::insert (cgraph_node *, ipa_node_params *info)
 {
   info->lattices = NULL;
   info->ipcp_orig_node = NULL;
+  info->known_csts = vNULL;
+  info->known_contexts = vNULL;
   info->analysis_done = 0;
   info->node_enqueued = 0;
   info->do_clone_for_all_contexts = 0;