From patchwork Tue Oct 8 13:28:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1994270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=hOGCpMci; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=K8lVaweZ; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=hOGCpMci; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=K8lVaweZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XNH0d6s0Bz1xvN for ; Wed, 9 Oct 2024 00:28:49 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2ECA73861837 for ; Tue, 8 Oct 2024 13:28:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 8356A385842D for ; Tue, 8 Oct 2024 13:28:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8356A385842D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8356A385842D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728394106; cv=none; b=Tvv8guYvXRiVXoyEw9kHHsTxJ5mM7zWUYYApiI2SvELRc4xo1B2lpMFG5/W4+NFSx3Gv5IBOafY8R80b3jUsW8xcTO9xEd1CHz34O4ygNV1hYoMfTmJP8UyxXgHgfIP3neujwO3aQKlsCOagkAaEUssYB2SZVAcLZtu0ofkX+To= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728394106; c=relaxed/simple; bh=5KhvL4J7a1udNgXZJhZye47HFNJ/bZxj28w6dU17fz0=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=U6Ns5mXF7yc6Z1QqOBCFsbCybtRQiu1lFj/w/lV6FNvFfMExcWcbhIvagr15z4xxDdRQYSx3RykvQ8jEcAnoTs//JFcrhTkau+v6UVbMpgW0B+/rMfAft4hQWGmN4x567jnvm9L6Y2uvtvXNc3956t1nBQFNLee2u4o9O2bz5X8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from murzim.nue2.suse.org (unknown [10.168.4.243]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 23C6A1FB6C for ; Tue, 8 Oct 2024 13:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728394103; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=fCpl7qF/9ppaC9/TkW30gcaAjoRSobI/wW9QKFvF1pU=; b=hOGCpMci0x5SA7BdqjTKgeO6cPaX7hoOpXu1z0QexguBedHs5iyaPyK4MwjrYW/2WcxJEg /uZ8iwcS9tBNp4jwlyDj9o5IXw8VP1ZIMrTle73XCsNRUAifxs0dcwyEWJaTKQY7iaLcTa vB7QHdiYo4DsT5Ognj2iTZ0MMJKeZVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728394103; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=fCpl7qF/9ppaC9/TkW30gcaAjoRSobI/wW9QKFvF1pU=; b=K8lVaweZ4mvlj5SFe3fZZ9o7Ho6+QgalqQiIdrs34pPVFk99AA4c6wBlQYcSm9yfld0hlV DgoOjPn9Lybc79Bw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728394103; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=fCpl7qF/9ppaC9/TkW30gcaAjoRSobI/wW9QKFvF1pU=; b=hOGCpMci0x5SA7BdqjTKgeO6cPaX7hoOpXu1z0QexguBedHs5iyaPyK4MwjrYW/2WcxJEg /uZ8iwcS9tBNp4jwlyDj9o5IXw8VP1ZIMrTle73XCsNRUAifxs0dcwyEWJaTKQY7iaLcTa vB7QHdiYo4DsT5Ognj2iTZ0MMJKeZVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728394103; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=fCpl7qF/9ppaC9/TkW30gcaAjoRSobI/wW9QKFvF1pU=; b=K8lVaweZ4mvlj5SFe3fZZ9o7Ho6+QgalqQiIdrs34pPVFk99AA4c6wBlQYcSm9yfld0hlV DgoOjPn9Lybc79Bw== Date: Tue, 8 Oct 2024 15:28:23 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix memory leak in vect_cse_slp_nodes MIME-Version: 1.0 X-Spam-Score: -1.10 X-Spamd-Result: default: False [-1.10 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MISSING_MID(2.50)[]; NEURAL_HAM_LONG(-0.32)[-0.325]; NEURAL_HAM_SHORT(-0.17)[-0.874]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+] X-Spam-Level: X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Message-Id: <20241008132848.2ECA73861837@sourceware.org> The following avoids copying scalar stmts again for the re-lookup of the slot to replace the NULL guard with node. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. * tree-vect-slp.cc (vect_cse_slp_nodes): Fix memory leak. --- gcc/tree-vect-slp.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 849863c1505..44ce9dbbab2 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -7024,7 +7024,7 @@ vect_cse_slp_nodes (scalar_stmts_to_slp_tree_map_t *bst_map, slp_tree& node) /* Now record the node for CSE in other siblings. */ if (put_p) - bst_map->put (SLP_TREE_SCALAR_STMTS (node).copy (), node); + *bst_map->get (SLP_TREE_SCALAR_STMTS (node)) = node; } /* Optimize the SLP graph of VINFO. */