From patchwork Fri Aug 17 07:46:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 178155 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 31AD92C0092 for ; Fri, 17 Aug 2012 17:49:24 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1345794564; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=J4i19v2+PuY1v5jZfXy6 t+IhFFk=; b=bj2nMjScIKR0p6qSUbxraOKcD+ipS1s4oHDUvrgiJ039rQ9wQqiR Y4e6hoULSZsB2lYG+yqFy/4nYMynErqBcD/L0nK+oUpVxFNYxw70V1KlRL4+PhWf 4Esm7fLWN3MaoqTVYDL3J45hzxdXjCDPkLy//+VFPqu8z7CDLabGAQ0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=mzj3OvnTHW3oslgSwTeQWHUL/ik2M941pjMflVF16rDe+EQHRFox0tXV/ksrSQ Qldrougi8njnJwgkUzkImPUafms22k5y5qyyUT9vjrrZBHsvWHsP8eKBe7fGiqbW nW2EJs3spGjjZGGHxy8I5Bd+VNjk9gZm/Fce5G5LJ5p90=; Received: (qmail 8748 invoked by alias); 17 Aug 2012 07:49:16 -0000 Received: (qmail 8725 invoked by uid 22791); 17 Aug 2012 07:49:13 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, TW_TM X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 17 Aug 2012 07:49:00 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id C8942A2FD7 for ; Fri, 17 Aug 2012 09:48:58 +0200 (CEST) Date: Fri, 17 Aug 2012 09:46:35 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] More leak plugs for PR54146 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2012-08-16 Richard Guenther * tree-sra.c (modify_function): Free redirect_callers vector. * ipa-split.c (split_function): Free args_to_pass vector. * tree-vect-data-refs.c (vect_peeling_hash_get_lowest_cost): Free body_cost_vec properly. (vect_enhance_data_refs_alignment): Likewise. * tree-vect-stmts.c (vectorizable_operation): Do not pre-allocate vec_oprnds. (new_stmt_vec_info): Do not pre-allocate STMT_VINFO_SAME_ALIGN_REFS. * tree-vect-slp.c (vect_free_slp_instance): Free the instance. (vect_analyze_slp_instance): Free everything. (destroy_bb_vec_info): Free the SLP instances. Index: gcc/ipa-split.c =================================================================== --- gcc/ipa-split.c (revision 190447) +++ gcc/ipa-split.c (working copy) @@ -1230,6 +1230,7 @@ split_function (struct split_point *spli } call = gimple_build_call_vec (node->symbol.decl, args_to_pass); gimple_set_block (call, DECL_INITIAL (current_function_decl)); + VEC_free (tree, heap, args_to_pass); /* We avoid address being taken on any variable used by split part, so return slot optimization is always possible. Moreover this is Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 190447) +++ gcc/tree-vect-data-refs.c (working copy) @@ -1368,6 +1368,7 @@ vect_peeling_hash_get_lowest_cost (void { min->inside_cost = inside_cost; min->outside_cost = outside_cost; + VEC_free (stmt_info_for_cost, heap, min->body_cost_vec); min->body_cost_vec = body_cost_vec; min->peel_info.dr = elem->dr; min->peel_info.npeel = elem->npeel; @@ -1880,7 +1881,10 @@ vect_enhance_data_refs_alignment (loop_v if (!stat) do_peeling = false; else - return stat; + { + VEC_free (stmt_info_for_cost, heap, body_cost_vec); + return stat; + } } if (do_peeling) @@ -1930,6 +1934,8 @@ vect_enhance_data_refs_alignment (loop_v gcc_assert (stat); return stat; } + else + VEC_free (stmt_info_for_cost, heap, body_cost_vec); } Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 190447) +++ gcc/tree-vect-stmts.c (working copy) @@ -3585,22 +3585,6 @@ vectorizable_operation (gimple stmt, gim /* Handle def. */ vec_dest = vect_create_destination_var (scalar_dest, vectype); - /* Allocate VECs for vector operands. In case of SLP, vector operands are - created in the previous stages of the recursion, so no allocation is - needed, except for the case of shift with scalar shift argument. In that - case we store the scalar operand in VEC_OPRNDS1 for every vector stmt to - be created to vectorize the SLP group, i.e., SLP_NODE->VEC_STMTS_SIZE. - In case of loop-based vectorization we allocate VECs of size 1. We - allocate VEC_OPRNDS1 only in case of binary operation. */ - if (!slp_node) - { - vec_oprnds0 = VEC_alloc (tree, heap, 1); - if (op_type == binary_op || op_type == ternary_op) - vec_oprnds1 = VEC_alloc (tree, heap, 1); - if (op_type == ternary_op) - vec_oprnds2 = VEC_alloc (tree, heap, 1); - } - /* In case the vectorization factor (VF) is bigger than the number of elements that we can fit in a vectype (nunits), we have to generate more than one vector stmt - i.e - we need to "unroll" the @@ -5866,7 +5850,7 @@ new_stmt_vec_info (gimple stmt, loop_vec else STMT_VINFO_DEF_TYPE (res) = vect_internal_def; - STMT_VINFO_SAME_ALIGN_REFS (res) = VEC_alloc (dr_p, heap, 5); + STMT_VINFO_SAME_ALIGN_REFS (res) = NULL; STMT_SLP_TYPE (res) = loop_vect; GROUP_FIRST_ELEMENT (res) = NULL; GROUP_NEXT_ELEMENT (res) = NULL; Index: gcc/tree-sra.c =================================================================== --- gcc/tree-sra.c (revision 190447) +++ gcc/tree-sra.c (working copy) @@ -4698,6 +4698,8 @@ modify_function (struct cgraph_node *nod new_node = cgraph_function_versioning (node, redirect_callers, NULL, NULL, false, NULL, NULL, "isra"); + VEC_free (cgraph_edge_p, heap, redirect_callers); + current_function_decl = new_node->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (new_node->symbol.decl)); Index: gcc/tree-vect-slp.c =================================================================== --- gcc/tree-vect-slp.c (revision 190447) +++ gcc/tree-vect-slp.c (working copy) @@ -94,6 +94,7 @@ vect_free_slp_instance (slp_instance ins VEC_free (int, heap, SLP_INSTANCE_LOAD_PERMUTATION (instance)); VEC_free (slp_tree, heap, SLP_INSTANCE_LOADS (instance)); VEC_free (stmt_info_for_cost, heap, SLP_INSTANCE_BODY_COST_VEC (instance)); + free (instance); } @@ -1581,8 +1582,11 @@ vect_analyze_slp_instance (loop_vec_info if (vect_print_dump_info (REPORT_SLP)) fprintf (vect_dump, "Build SLP failed: unrolling required in basic" " block SLP"); + vect_free_slp_tree (node); VEC_free (stmt_info_for_cost, heap, body_cost_vec); VEC_free (stmt_info_for_cost, heap, prologue_cost_vec); + VEC_free (int, heap, load_permutation); + VEC_free (slp_tree, heap, loads); return false; } @@ -1858,8 +1862,11 @@ new_bb_vec_info (basic_block bb) static void destroy_bb_vec_info (bb_vec_info bb_vinfo) { + VEC (slp_instance, heap) *slp_instances; + slp_instance instance; basic_block bb; gimple_stmt_iterator si; + unsigned i; if (!bb_vinfo) return; @@ -1879,6 +1886,9 @@ destroy_bb_vec_info (bb_vec_info bb_vinf free_data_refs (BB_VINFO_DATAREFS (bb_vinfo)); free_dependence_relations (BB_VINFO_DDRS (bb_vinfo)); VEC_free (gimple, heap, BB_VINFO_GROUPED_STORES (bb_vinfo)); + slp_instances = BB_VINFO_SLP_INSTANCES (bb_vinfo); + FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance) + vect_free_slp_instance (instance); VEC_free (slp_instance, heap, BB_VINFO_SLP_INSTANCES (bb_vinfo)); destroy_cost_data (BB_VINFO_TARGET_COST_DATA (bb_vinfo)); free (bb_vinfo);