From 23e62d2e6cbc8590fb59d3be6e925548db54ccda Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 23 Nov 2007 14:28:59 +0000 Subject: 2007-11-23 Richard Guenther Michael Matz PR tree-optimization/34176 * alloc-pool.h (empty_alloc_pool): Declare. * alloc-pool.c (empty_alloc_pool): New function. * tree-ssa-sccvn.c (vn_reference_lookup): Also lookup from the valid table if a lookup from the optimistic table failed. (vn_unary_op_lookup): Likewise. (vn_binary_op_lookup): Likewise. (vn_phi_lookup): Likewise. (process_scc): Clear optimistic tables before every iteration. * gcc.c-torture/execute/pr34176.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@130379 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/alloc-pool.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'gcc/alloc-pool.c') diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c index 1b3dc915509..d5d1fab79af 100644 --- a/gcc/alloc-pool.c +++ b/gcc/alloc-pool.c @@ -183,7 +183,7 @@ create_alloc_pool (const char *name, size_t size, size_t num) /* Free all memory allocated for the given memory pool. */ void -free_alloc_pool (alloc_pool pool) +empty_alloc_pool (alloc_pool pool) { alloc_pool_list block, next_block; #ifdef GATHER_STATISTICS @@ -201,6 +201,22 @@ free_alloc_pool (alloc_pool pool) desc->current -= pool->block_size; #endif } + + pool->returned_free_list = NULL; + pool->virgin_free_list = NULL; + pool->virgin_elts_remaining = 0; + pool->elts_allocated = 0; + pool->elts_free = 0; + pool->blocks_allocated = 0; + pool->block_list = NULL; +} + +/* Free all memory allocated for the given memory pool and the pool itself. */ +void +free_alloc_pool (alloc_pool pool) +{ + /* First empty the pool. */ + empty_alloc_pool (pool); #ifdef ENABLE_CHECKING memset (pool, 0xaf, sizeof (*pool)); #endif -- cgit v1.2.3