public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Plug SSA stmt operand leak
@ 2014-11-10 13:09 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2014-11-10 13:09 UTC (permalink / raw)
  To: gcc-patches


The following patch plugs a leak in SSA stmt operands.  finalize_ssa_uses
always frees all old operands and then allocates new ones - but in
freeing the old operands it only inserts the first freed one into
the freelist.  The following patch makes us use the same trick
as free_stmt_operands to link all old uses to the freelist.

As the stmt operands have their own allocator and we dispose
of its memory in one-go (per function) it may not be a too
big deal - but SSA form is live for a lot of functions at the
same time.

I was of course working on sth else here that requires not
throwing away the old uses unconditionally for efficiency
but the patch applies to active branches as well which is
why I am testing the fix anyway.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2014-11-10  Richard Biener  <rguenther@suse.de>

	* tree-ssa-operands.c (finalize_ssa_uses): Properly put
	released operands on the free list.

Index: gcc/tree-ssa-operands.c
===================================================================
--- gcc/tree-ssa-operands.c	(revision 216973)
+++ gcc/tree-ssa-operands.c	(working copy)
@@ -409,9 +410,10 @@ finalize_ssa_uses (struct function *fn,
   /* If there is anything in the old list, free it.  */
   if (old_ops)
     {
-      for (ptr = old_ops; ptr; ptr = ptr->next)
+      for (ptr = old_ops; ptr->next; ptr = ptr->next)
 	delink_imm_use (USE_OP_PTR (ptr));
-      old_ops->next = gimple_ssa_operands (fn)->free_uses;
+      delink_imm_use (USE_OP_PTR (ptr));
+      ptr->next = gimple_ssa_operands (fn)->free_uses;
       gimple_ssa_operands (fn)->free_uses = old_ops;
     }
 

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

only message in thread, other threads:[~2014-11-10 12:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-10 13:09 [PATCH] Plug SSA stmt operand leak Richard Biener

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