From: Martin Liska Date: Fri, 13 Nov 2015 12:28:54 +0000 (+0100) Subject: Fix memory leaks in graphite X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec17e433968e84be64522e6955e2f226fa01d295;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fde5bef6522..9c3e6dff8a0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-11-13 Martin Liska + + * 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 PR ipa/68311 diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 5928b4ce606..809670ab330 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 a7179d97d89..b5298d7e0a2 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 drs; - drs.create (3); - vec writes; - writes.create (3); - vec reads; - reads.create (3); + vec drs = vNULL; + vec writes = vNULL; + vec reads = vNULL; sese_l region = scop->scop_info->region; loop_p nest = outermost_loop_in_sese (region, bb);