aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-11-13 13:28:54 +0100
committerMartin Liska <marxin@gcc.gnu.org>2015-11-13 12:28:54 +0000
commitec17e433968e84be64522e6955e2f226fa01d295 (patch)
tree81fe881afee0e3d324dd6e666a0fcb37af25dd66
parentc9ab724f84ee63a89e95a8b1995e30aed253d295 (diff)
downloadgcc-ec17e433968e84be64522e6955e2f226fa01d295.zip
gcc-ec17e433968e84be64522e6955e2f226fa01d295.tar.gz
gcc-ec17e433968e84be64522e6955e2f226fa01d295.tar.bz2
Fix memory leaks in graphite
* graphite-poly.c (free_scop): Release scop->drs vector. * graphite-scop-detection.c (scop_detection::harmful_stmt_in_region): Release dom vector. (try_generate_gimple_bb): Use vNULL as a default initialization for vectors. From-SVN: r230312
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/graphite-poly.c1
-rw-r--r--gcc/graphite-scop-detection.c27
3 files changed, 27 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fde5bef6..9c3e6df 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2015-11-13 Martin Liska <mliska@suse.cz>
+ * graphite-poly.c (free_scop): Release scop->drs vector.
+ * graphite-scop-detection.c (scop_detection::harmful_stmt_in_region):
+ Release dom vector.
+ (try_generate_gimple_bb): Use vNULL as a default initialization
+ for vectors.
+
+2015-11-13 Martin Liska <mliska@suse.cz>
+
PR ipa/68311
* ipa-icf.c (sem_item_optimizer::traverse_congruence_split):
Replace ctor with auto_vec and initialization in a loop.
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 5928b4c..809670a 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -328,6 +328,7 @@ free_scop (scop_p scop)
free_poly_bb (pbb);
scop->pbbs.release ();
+ scop->drs.release ();
isl_set_free (scop->param_context);
isl_union_map_free (scop->must_raw);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index a7179d9..b5298d7 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -522,6 +522,11 @@ class scop_detection
public:
scop_detection () : scops (vNULL) {}
+ ~scop_detection ()
+ {
+ scops.release ();
+ }
+
/* A marker for invalid sese_l. */
static sese_l invalid_sese;
@@ -1065,13 +1070,20 @@ scop_detection::harmful_stmt_in_region (sese_l scop) const
/* The basic block should not be part of an irreducible loop. */
if (bb->flags & BB_IRREDUCIBLE_LOOP)
- return true;
+ {
+ dom.release ();
+ return true;
+ }
if (harmful_stmt_in_bb (scop, bb))
- return true;
+ {
+ dom.release ();
+ return true;
+ }
}
- return false;
+ dom.release ();
+ return false;
}
/* Returns true if S1 subsumes/surrounds S2. */
@@ -1749,12 +1761,9 @@ graphite_find_cross_bb_scalar_vars (scop_p scop, gimple *stmt,
static gimple_poly_bb_p
try_generate_gimple_bb (scop_p scop, basic_block bb)
{
- vec<data_reference_p> drs;
- drs.create (3);
- vec<tree> writes;
- writes.create (3);
- vec<scalar_use> reads;
- reads.create (3);
+ vec<data_reference_p> drs = vNULL;
+ vec<tree> writes = vNULL;
+ vec<scalar_use> reads = vNULL;
sese_l region = scop->scop_info->region;
loop_p nest = outermost_loop_in_sese (region, bb);