IPA ICF: fix memory leak.
* ipa-icf.c (sem_function::equals_private): int* is replaced with auto_vec. (sem_function::bb_dict_test): Likewise. * ipa-icf.h: Likewise. Co-Authored-By: David Malcolm <dmalcolm@redhat.com> From-SVN: r218129
This commit is contained in:
parent
a92bf1b1c7
commit
c190efccf0
3 changed files with 19 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
|||
2014-11-27 Martin Liska <mliska@suse.cz>
|
||||
David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* ipa-icf.c (sem_function::equals_private): int* is replaced with
|
||||
auto_vec.
|
||||
(sem_function::bb_dict_test): Likewise.
|
||||
* ipa-icf.h: Likewise.
|
||||
|
||||
2014-11-27 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/64088
|
||||
|
|
|
@ -410,7 +410,6 @@ sem_function::equals_private (sem_item *item,
|
|||
basic_block bb1, bb2;
|
||||
edge e1, e2;
|
||||
edge_iterator ei1, ei2;
|
||||
int *bb_dict = NULL;
|
||||
bool result = true;
|
||||
tree arg1, arg2;
|
||||
|
||||
|
@ -486,12 +485,11 @@ sem_function::equals_private (sem_item *item,
|
|||
|
||||
dump_message ("All BBs are equal\n");
|
||||
|
||||
auto_vec <int> bb_dict;
|
||||
|
||||
/* Basic block edges check. */
|
||||
for (unsigned i = 0; i < bb_sorted.length (); ++i)
|
||||
{
|
||||
bb_dict = XNEWVEC (int, bb_sorted.length () + 2);
|
||||
memset (bb_dict, -1, (bb_sorted.length () + 2) * sizeof (int));
|
||||
|
||||
bb1 = bb_sorted[i]->bb;
|
||||
bb2 = m_compared_func->bb_sorted[i]->bb;
|
||||
|
||||
|
@ -957,9 +955,15 @@ sem_function::icf_handled_component_p (tree t)
|
|||
corresponds to TARGET. */
|
||||
|
||||
bool
|
||||
sem_function::bb_dict_test (int* bb_dict, int source, int target)
|
||||
sem_function::bb_dict_test (auto_vec<int> bb_dict, int source, int target)
|
||||
{
|
||||
if (bb_dict[source] == -1)
|
||||
source++;
|
||||
target++;
|
||||
|
||||
if (bb_dict.length () <= (unsigned)source)
|
||||
bb_dict.safe_grow_cleared (source + 1);
|
||||
|
||||
if (bb_dict[source] == 0)
|
||||
{
|
||||
bb_dict[source] = target;
|
||||
return true;
|
||||
|
|
|
@ -275,7 +275,7 @@ private:
|
|||
|
||||
/* Basic blocks dictionary BB_DICT returns true if SOURCE index BB
|
||||
corresponds to TARGET. */
|
||||
bool bb_dict_test (int* bb_dict, int source, int target);
|
||||
bool bb_dict_test (auto_vec<int> bb_dict, int source, int target);
|
||||
|
||||
/* Iterates all tree types in T1 and T2 and returns true if all types
|
||||
are compatible. If COMPARE_POLYMORPHIC is set to true,
|
||||
|
|
Loading…
Add table
Reference in a new issue