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 <rguent...@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; }