public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [5/n] Fix minor SSA_NAME leaks
@ 2015-10-09  5:40 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2015-10-09  5:40 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]


This set of leaks is a bit more interesting.  value-prof just blindly 
clears the vdefs on certain statements.  Of course that results in a 
leaked SSA_NAME.

The first of the three instances was the one I hit, the others were 
found by inspection.  Like prior patches, I've kept a minimized testcase 
for this issue.

FWIW, with this patch I can now bootstrap x86-64 with my code to verify 
we haven't leaked any SSA_NAMEs.   My verifier knows about a purposeful 
leak in function splitting and doesn't warn about leaks stemming from 
that code.

There's still a ton of leaks in the vectorizer and probably elsewhere, 
but being able to bootstrap is a notable achievement.


Bootstrapped and regression tested on x86_64-linux-gnu.  Installed on 
the trunk.

Jeff

[-- Attachment #2: PP --]
[-- Type: text/plain, Size: 1707 bytes --]

	* value-prof.c (gimple_ic): Add missing calls to unlink_stmt_vdef
	and release_ssa_name in two places.
	(gimple_stringop_fixed_value): Similarly.

diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 90211ef..ddf1215 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1384,6 +1384,11 @@ gimple_ic (gcall *icall_stmt, struct cgraph_node *direct_call,
   cond_stmt = gimple_build_cond (EQ_EXPR, tmp1, tmp0, NULL_TREE, NULL_TREE);
   gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
 
+  if (TREE_CODE (gimple_vdef (icall_stmt)) == SSA_NAME)
+    {
+      unlink_stmt_vdef (icall_stmt);
+      release_ssa_name (gimple_vdef (icall_stmt));
+    }
   gimple_set_vdef (icall_stmt, NULL_TREE);
   gimple_set_vuse (icall_stmt, NULL_TREE);
   update_stmt (icall_stmt);
@@ -1472,6 +1477,11 @@ gimple_ic (gcall *icall_stmt, struct cgraph_node *direct_call,
 	    {
 	      gimple *copy;
 
+	      if (TREE_CODE (gimple_vdef (iretbnd_stmt)) == SSA_NAME)
+		{
+	          unlink_stmt_vdef (iretbnd_stmt);
+	          release_ssa_name (gimple_vdef (iretbnd_stmt));
+		}
 	      gimple_set_vdef (iretbnd_stmt, NULL_TREE);
 	      gimple_set_vuse (iretbnd_stmt, NULL_TREE);
 	      update_stmt (iretbnd_stmt);
@@ -1698,6 +1708,11 @@ gimple_stringop_fixed_value (gcall *vcall_stmt, tree icall_size, int prob,
   cond_stmt = gimple_build_cond (EQ_EXPR, tmp1, tmp0, NULL_TREE, NULL_TREE);
   gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
 
+  if (TREE_CODE (gimple_vdef (vcall_stmt)) == SSA_NAME)
+    {
+      unlink_stmt_vdef (vcall_stmt);
+      release_ssa_name (gimple_vdef (vcall_stmt));
+    }
   gimple_set_vdef (vcall_stmt, NULL);
   gimple_set_vuse (vcall_stmt, NULL);
   update_stmt (vcall_stmt);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-09  5:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09  5:40 [PATCH] [5/n] Fix minor SSA_NAME leaks Jeff Law

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).