From patchwork Thu Sep 23 15:52:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 65544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8E43EB70DF for ; Fri, 24 Sep 2010 01:53:27 +1000 (EST) Received: (qmail 11119 invoked by alias); 23 Sep 2010 15:53:26 -0000 Received: (qmail 11110 invoked by uid 22791); 23 Sep 2010 15:53:25 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yw0-f47.google.com (HELO mail-yw0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Sep 2010 15:53:20 +0000 Received: by ywe9 with SMTP id 9so467265ywe.20 for ; Thu, 23 Sep 2010 08:53:18 -0700 (PDT) Received: by 10.151.84.3 with SMTP id m3mr2991530ybl.182.1285257198232; Thu, 23 Sep 2010 08:53:18 -0700 (PDT) Received: from napoca ([163.181.251.115]) by mx.google.com with ESMTPS id w3sm7494592ybi.19.2010.09.23.08.53.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 23 Sep 2010 08:53:17 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Thu, 23 Sep 2010 10:53:15 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com, Sebastian Pop Subject: [PATCH 1/3] Fix Graphite memory leaks. Date: Thu, 23 Sep 2010 10:52:48 -0500 Message-Id: <1285257170-11174-1-git-send-email-sebpop@gmail.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 2010-09-23 Sebastian Pop * graphite-clast-to-gimple.c (compute_bounds_for_level): Free le and ps. * graphite-poly.c (pbb_number_of_iterations_at_time): Free le and domain. * graphite-sese-to-poly.c (add_upper_bounds_from_estimated_nit): Do not allocate ub_expr, it is passed in initialized. --- gcc/ChangeLog.graphite | 9 +++++++++ gcc/graphite-clast-to-gimple.c | 2 ++ gcc/graphite-poly.c | 2 ++ gcc/graphite-sese-to-poly.c | 1 - 4 files changed, 13 insertions(+), 1 deletions(-) diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index a191c61..d8305b9 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,12 @@ +2010-09-23 Sebastian Pop + + * graphite-clast-to-gimple.c (compute_bounds_for_level): Free le + and ps. + * graphite-poly.c (pbb_number_of_iterations_at_time): Free le and + domain. + * graphite-sese-to-poly.c (add_upper_bounds_from_estimated_nit): + Do not allocate ub_expr, it is passed in initialized. + 2010-09-21 Andreas Simbuerger * common.opt (fgraphite-dump-cloog): New flag. diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index 19b3f7f..430f1ad 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -703,6 +703,8 @@ compute_bounds_for_level (poly_bb_p pbb, int level, mpz_t low, mpz_t up) ppl_max_for_le_pointset (ps, le, up); ppl_min_for_le_pointset (ps, le, low); + ppl_delete_Linear_Expression (le); + ppl_delete_Pointset_Powerset_C_Polyhedron (ps); } /* Compute the type for the induction variable at LEVEL for the diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index a122a9c..265de78 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -1736,8 +1736,10 @@ pbb_number_of_iterations_at_time (poly_bb_p pbb, mpz_clear (diff); mpz_clear (lb); mpz_clear (ub); + ppl_delete_Linear_Expression (le); ppl_delete_Pointset_Powerset_C_Polyhedron (sctr_ub); ppl_delete_Pointset_Powerset_C_Polyhedron (sctr_lb); + ppl_delete_Pointset_Powerset_C_Polyhedron (domain); } /* Translates LOOP to LST. */ diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 1ee6fee..87b226b 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -1032,7 +1032,6 @@ add_upper_bounds_from_estimated_nit (scop_p scop, double_int nit, ppl_Coefficient_t coef; ppl_Constraint_t ub; - ppl_new_Linear_Expression_with_dimension (&ub_expr, dim); ppl_new_C_Polyhedron_from_space_dimension (&pol, dim, 0); ppl_new_Linear_Expression_from_Linear_Expression (&nb_iters_le, ub_expr);