From patchwork Fri Jun 28 06:42:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B8rgen_Kvalsvik?= X-Patchwork-Id: 1953714 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=kolabnow.com header.i=@kolabnow.com header.a=rsa-sha256 header.s=dkim20240523 header.b=d2Fftvq4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4W9QqW1Cycz20Xf for ; Fri, 28 Jun 2024 16:42:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 628453882651 for ; Fri, 28 Jun 2024 06:42:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx.kolabnow.com (mx.kolabnow.com [212.103.80.154]) by sourceware.org (Postfix) with ESMTPS id 22F6F3882079 for ; Fri, 28 Jun 2024 06:42:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 22F6F3882079 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lambda.is Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lambda.is ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 22F6F3882079 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.103.80.154 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719556956; cv=none; b=nzbv2/7FRf12SGUnMX0SEKeYgzJ5YDjgcq/wnAIAv7rtKn3mSoz87xVMEwVcuEphu+u60QI7KDlf/0WZzwl/i7h0E4A1YaIstSuRbMiAMDTRRIbwz2+TYO1eNNoAHeiKFyv8iBGFAgGqy8Rt9OjNFpzdXnceqLKsn3wr+0grcF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719556956; c=relaxed/simple; bh=IYh7ojfHOcswvFfQUW0/HpWSeg8k53LMqYT4JQjPtvg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=FwUd+vDc0F71KEN6C3KDwC61vDLwXUN3gWh3y7QB2uSD0K7Ts8rRqSFd+CSwn0QxA4kuP9Zg88GbiBI4xDgfbh9wSx3WPfvRHfaotG+/zVeeTFubUvURgs76y3RqWUwJDgfdUIJSKcPausj3M2c7gM5vF4Acp7o1N9A8NaXFkg4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id B0968300569E; Fri, 28 Jun 2024 08:42:30 +0200 (CEST) Authentication-Results: ext-mx-out013.mykolab.com (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:mime-version:message-id:date:date :subject:subject:from:from:received:received:received; s= dkim20240523; t=1719556947; x=1721371348; bh=YUG/rLAMuolDW0UqNP5 mKdul/znZJUpxl6dRsLZcDac=; b=d2Fftvq4vqbo1i6c2rcKMuxZ2wv/ARhbSG3 5rAtR4ZSSZQsIOL3R8pt/PSF7mChM4hOeFfJuRabittz9yfzUcg8sw+9sJsgsxDy Ge+AmxPnMsTcuAdHjEYBtnTfO4XjUOS1av6mLml4gCCov2gbCq7+pzKGzzI9uOSq 1ClM+YDOCPBRigw+ARB4QjYdWvd96k0+HfA4I/CMP0SaKGr+3UMfBlCutT6rEGit t+47ebOsZqHNjbyvD1pjsCl1gX5hd8ooqj2KwWLjEcAYFWDl66hFtXW6CW+erLuG N2NTOWH9RiDS+vYK3KFpyTBUSorixdVWYDSDfLHJxiXLtw4wJzQ== X-Virus-Scanned: amavis at mykolab.com X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out013.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id o9rf55otQ2MH; Fri, 28 Jun 2024 08:42:27 +0200 (CEST) Received: from int-mx009.mykolab.com (unknown [10.9.13.9]) by mx.kolabnow.com (Postfix) with ESMTPS id 911D73004C62; Fri, 28 Jun 2024 08:42:26 +0200 (CEST) Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx009.mykolab.com (Postfix) with ESMTPS id 2977B21F7279; Fri, 28 Jun 2024 08:42:26 +0200 (CEST) From: =?utf-8?q?J=C3=B8rgen_Kvalsvik?= To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, =?utf-8?q?J=C3=B8rgen_Kvalsvik?= Subject: [PATCH] Use move-aware auto_vec in map Date: Fri, 28 Jun 2024 08:42:19 +0200 Message-Id: <20240628064219.2445887-1-j@lambda.is> MIME-Version: 1.0 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 Using auto_vec rather than vec for means the vectors are release automatically upon return, to stop the leak. The problem seems is that auto_vec is not really move-aware, only the specialization is. This is actually Jan's original suggestion https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655600.html which I improvised on by also using embedded storage. I think it should fix this regression: https://gcc.gnu.org/pipermail/gcc-regression/2024-June/080152.html I could not reproduce it on x86-64 linux, so if someone could help me test it on aarch64 that would be much appreciated. --- gcc/ChangeLog: * tree-profile.cc (find_conditions): Use auto_vec without embedded storage. --- gcc/tree-profile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc index 8c9945847ca..153c9323040 100644 --- a/gcc/tree-profile.cc +++ b/gcc/tree-profile.cc @@ -876,7 +876,7 @@ find_conditions (struct function *fn) make_top_index (fnblocks, ctx.B1, ctx.top_index); /* Bin the Boolean expressions so that exprs[id] -> [x1, x2, ...]. */ - hash_map, auto_vec> exprs; + hash_map, auto_vec> exprs; for (basic_block b : fnblocks) { const unsigned uid = condition_uid (fn, b);