omega.c (coalesce): Fix memory leak on early exit.

2007-07-15  Dirk Mueller  <dmueller@suse.de>

        * omega.c (coalesce): Fix memory leak on early exit.
        * matrix-reorg.c (check_allocation_function): Likewise.
        * tree-vect-transform.c (vect_get_new_vect_var): free result
        of concat().
        * bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges):
        pass pointer to edge vector
        (partition_hot_cold_basic_blocks): Fix memory leak.
        * collect2.c (prefix_from_string): Free temporary storage.
        * reload1.c (fixup_abnormal_edges): Free sbitmap.

From-SVN: r126653
This commit is contained in:
Dirk Mueller 2007-07-15 11:45:30 +00:00 committed by Dirk Mueller
parent d40150cc3c
commit 639d3040d4
7 changed files with 32 additions and 9 deletions

View file

@ -1,3 +1,15 @@
2007-07-14 Dirk Mueller <dmueller@suse.de>
* omega.c (coalesce): Fix memory leak on early exit.
* matrix-reorg.c (check_allocation_function): Likewise.
* tree-vect-transform.c (vect_get_new_vect_var): free result
of concat().
* bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges):
pass pointer to edge vector
(partition_hot_cold_basic_blocks): Fix memory leak.
* collect2.c (prefix_from_string): Free temporary storage.
* reload1.c (fixup_abnormal_edges): Free sbitmap.
2007-07-14 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.h (DO_GLOBAL_CTORS_BODY): Add void to prototype.

View file

@ -180,7 +180,7 @@ static void connect_traces (int, struct trace *);
static bool copy_bb_p (basic_block, int);
static int get_uncond_jump_length (void);
static bool push_to_next_round_p (basic_block, int, int, int, gcov_type);
static void find_rarely_executed_basic_blocks_and_crossing_edges (edge *,
static void find_rarely_executed_basic_blocks_and_crossing_edges (edge **,
int *,
int *);
static void add_labels_and_missing_jumps (edge *, int);
@ -1219,7 +1219,7 @@ get_uncond_jump_length (void)
cache locality). */
static void
find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
find_rarely_executed_basic_blocks_and_crossing_edges (edge **crossing_edges,
int *n_crossing_edges,
int *max_idx)
{
@ -1256,10 +1256,10 @@ find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
if (i == *max_idx)
{
*max_idx *= 2;
crossing_edges = xrealloc (crossing_edges,
*crossing_edges = xrealloc (*crossing_edges,
(*max_idx) * sizeof (edge));
}
crossing_edges[i++] = e;
(*crossing_edges)[i++] = e;
}
else
e->flags &= ~EDGE_CROSSING;
@ -2168,7 +2168,7 @@ partition_hot_cold_basic_blocks (void)
&& cur_bb->next_bb->index >= NUM_FIXED_BLOCKS)
cur_bb->aux = cur_bb->next_bb;
find_rarely_executed_basic_blocks_and_crossing_edges (crossing_edges,
find_rarely_executed_basic_blocks_and_crossing_edges (&crossing_edges,
&n_crossing_edges,
&max_edges);

View file

@ -737,6 +737,7 @@ prefix_from_string (const char *p, struct path_prefix *pprefix)
else
endp++;
}
free (nstore);
}
/* Main program. */

View file

@ -1481,10 +1481,13 @@ check_allocation_function (void **slot, void *data ATTRIBUTE_UNUSED)
block_stmt_iterator bsi;
basic_block bb_level_0;
struct matrix_info *mi = *slot;
sbitmap visited = sbitmap_alloc (num_ssa_names);
sbitmap visited;
if (!mi->malloc_for_level)
return 1;
visited = sbitmap_alloc (num_ssa_names);
/* Do nothing if the current function is not the allocation
function of MI. */
if (mi->allocation_function_decl != current_function_decl

View file

@ -2454,7 +2454,7 @@ coalesce (omega_pb pb)
{
int e, e2;
int colors = 0;
bool *is_dead = XNEWVEC (bool, OMEGA_MAX_GEQS);
bool *is_dead;
int found_something = 0;
for (e = 0; e < pb->num_geqs; e++)
@ -2464,6 +2464,8 @@ coalesce (omega_pb pb)
if (colors < 2)
return;
is_dead = XNEWVEC (bool, OMEGA_MAX_GEQS);
for (e = 0; e < pb->num_geqs; e++)
is_dead[e] = false;

View file

@ -8639,6 +8639,7 @@ fixup_abnormal_edges (void)
blocks = sbitmap_alloc (last_basic_block);
sbitmap_ones (blocks);
find_many_sub_basic_blocks (blocks);
sbitmap_free (blocks);
}
if (inserted)

View file

@ -671,7 +671,11 @@ vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name)
}
if (name)
new_vect_var = create_tmp_var (type, concat (prefix, name, NULL));
{
char* tmp = concat (prefix, name, NULL);
new_vect_var = create_tmp_var (type, tmp);
free (tmp);
}
else
new_vect_var = create_tmp_var (type, prefix);
@ -4443,7 +4447,7 @@ vect_transform_strided_load (tree stmt, VEC(tree,heap) *dr_chain, int size,
corresponds the order of data-refs in RESULT_CHAIN. */
next_stmt = first_stmt;
gap_count = 1;
for (i = 0; VEC_iterate(tree, result_chain, i, tmp_data_ref); i++)
for (i = 0; VEC_iterate (tree, result_chain, i, tmp_data_ref); i++)
{
if (!next_stmt)
break;