From patchwork Wed May 20 02:21:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 474126 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 37A89140D4D for ; Wed, 20 May 2015 12:21:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=WTVsYRav; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=sztryHZ7IUAKzeIDQCjEtvZeM/8WnyQUWjII6nJou/AuOM j14J76H9PZIDYV4cWPF9H8VZzSy5a/cBwjBkr62/WjsjlNUpO2ABLv4tRpobJ5AO 9L1BxW60Ah2hwlVfhmLdN+vQUJ4HZ3+VZKPsuw2/gPZ3pXsxcvb6xYB+GGi3k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=q6jg3dvL55NNHmq92STMzMAZPgc=; b=WTVsYRavTS6XUu83zV72 BEYZqL8hbh9j1TGhsRgCQuhKahUcZTD3YN3oUVGhb5LTt9XigXu1KVmgP12pbrbl 2xJ2MrZar3S2Q8B3EoMLu6jPWuQBWgcZGn6Q1SJ+yu5DC2UjrFbsh93r90cZkaYi K92dwPF6xCIo992mvcRErRo= Received: (qmail 109028 invoked by alias); 20 May 2015 02:21:23 -0000 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 Received: (qmail 109019 invoked by uid 89); 20 May 2015 02:21:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 20 May 2015 02:21:21 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 9C2C58E7B1 for ; Wed, 20 May 2015 02:21:20 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-34.phx2.redhat.com [10.3.113.34]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4K2LKAa003678 for ; Tue, 19 May 2015 22:21:20 -0400 Message-ID: <555BEF9F.3010107@redhat.com> Date: Tue, 19 May 2015 20:21:19 -0600 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: Fix minor memory leak in jump threader X-IsSubscribed: yes Honza pointed out we were leaking some memory in the jump threading code. There's at least two leaks, this fixes the first. Bootstrapped and regression tested on x86_64-unknown-linux-gnu. Installed on the trunk. commit f4517a9d2f17b0890d9fe1159a3981985bed5672 Author: Jeff Law Date: Tue May 19 20:20:57 2015 -0600 * tree-ssa-threadupdate.c (thread_single_edge): Use delete_jump_thread instead of open-coded version. Also delete the jump thread created within this function. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 95326a3..95114fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-05-20 Jeff Law + + * tree-ssa-threadupdate.c (thread_single_edge): Use delete_jump_thread + instead of open-coded version. Also delete the jump thread created + within this function. + 2015-05-20 Alan Modra * config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Return diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 0d61c18..c5b78a4 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -1647,9 +1647,7 @@ thread_single_edge (edge e) vec *path = THREAD_PATH (e); edge eto = (*path)[1]->e; - for (unsigned int i = 0; i < path->length (); i++) - delete (*path)[i]; - delete path; + delete_jump_thread_path (path); e->aux = NULL; thread_stats.num_threaded_edges++; @@ -1693,6 +1691,7 @@ thread_single_edge (edge e) redirect_edge_and_branch (e, rd.dup_blocks[0]); flush_pending_stmts (e); + delete_jump_thread_path (npath); return rd.dup_blocks[0]; }