From patchwork Fri Apr 28 10:39:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1774860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=uVGG22VW; dkim-atps=neutral Received: from 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q78JF66B0z23td for ; Fri, 28 Apr 2023 20:40:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D88C73858431 for ; Fri, 28 Apr 2023 10:40:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D88C73858431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682678411; bh=pWNJIHYeMVvU0pUXoiHONh0pRvMyeDmmKu2EYVt5ako=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=uVGG22VWBLJ7EwbyY5PKAbgwF+vZ7giuF9eIdKAnbspFzM6PV5x82qal9Of+RrkRg svmTQk6IVQxL12+H4FLUNijVSRp1DNV1/FkN8pzPsbaUjwzL4Nhg27qWnY/rge2PRf nO6dkUZKphnbNXnCByZV9hpgR6VvttpPwNFvD+KE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2045.outbound.protection.outlook.com [40.107.21.45]) by sourceware.org (Postfix) with ESMTPS id 768093858418 for ; Fri, 28 Apr 2023 10:39:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 768093858418 Received: from AS4P189CA0044.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::13) by DB9PR08MB7700.eurprd08.prod.outlook.com (2603:10a6:10:393::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.22; Fri, 28 Apr 2023 10:39:42 +0000 Received: from AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:5dd:cafe::42) by AS4P189CA0044.outlook.office365.com (2603:10a6:20b:5dd::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.23 via Frontend Transport; Fri, 28 Apr 2023 10:39:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT031.mail.protection.outlook.com (100.127.140.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.22 via Frontend Transport; Fri, 28 Apr 2023 10:39:41 +0000 Received: ("Tessian outbound 5bb4c51d5a1f:v136"); Fri, 28 Apr 2023 10:39:41 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 87f44cdca02e8946 X-CR-MTA-TID: 64aa7808 Received: from 5a193e45fd7e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9615EF15-1388-4062-A840-A8D5B160BA00.1; Fri, 28 Apr 2023 10:39:34 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5a193e45fd7e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Apr 2023 10:39:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKRfaFZdkYA9xDHrwE/rRu0BwCqvz2wN5232RqqAw9L1/bcfR2qjB95xwgmLJh8lxMo7da4qoJgsQKHMJc0aNc39ZKpTMIZSykemVyONYvBQeJb9b5/mMwuARrQ7SibDzUGgWC/TB9G2C2qTYY1EUTl70ndrPj/eVm9A+lrccZcTvWTc4QSN0A+HDlhQt0+cbaEmn7G7iTQIhtNO8eC+mGQGrxs05zmaMriMcgMAnFvJEJpHCrLE3Gej4MLq7IQbo/6dBFTBh2XlDf1HArvegGYhEYcrIvmxhYaS5kSYRWDIMbjX4RfPSrgK8gSmHl/UymrSADAmOHOvfKwEDpitqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pWNJIHYeMVvU0pUXoiHONh0pRvMyeDmmKu2EYVt5ako=; b=DmLMEx5l5crJTRllE0119lrdyMEJnD/VLL2MUKXde9RFfhnrLS+IYfrn+U7HRiEwOU/cgbwSqR2moBV02RWCTmzRwzFvs59JuC7CRqdqs4c3nvG5QjVhqLDQEfHZdiX/rcjK8gnHnRXj7DXrMLCRPQ1KU1HLqiyDB5RQssNkigwM9V037ZWvosup55qu0DxwN2Vt6OGZNYxW5+LssruejJneMPaUtAiPRuir8Ye3qI5HduvoE/ztu6jvfbUy4A1H3bwFaVg2yrhdPZI9hnn9hev1A6YJdiTntXxXue4B7vr3d4L3gY5+wdkdYQoohgm08cb0d1hIOiM0ukEmArfEEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by AS8PR08MB8349.eurprd08.prod.outlook.com (2603:10a6:20b:56d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.21; Fri, 28 Apr 2023 10:39:31 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::82f2:dba0:1f9b:c8f]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::82f2:dba0:1f9b:c8f%7]) with mapi id 15.20.6340.023; Fri, 28 Apr 2023 10:39:31 +0000 Date: Fri, 28 Apr 2023 11:39:23 +0100 To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH 3/5] match.pd: CSE the dump output check. Message-ID: Content-Disposition: inline X-ClientProxiedBy: SA0PR11CA0083.namprd11.prod.outlook.com (2603:10b6:806:d2::28) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|AS8PR08MB8349:EE_|AM7EUR03FT031:EE_|DB9PR08MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: efcdcd8d-3bb2-4da5-fd8d-08db47d4dffd x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: wLn5CEfSmP7aXgfA3LESNsGTtgDw1//dIEqdU4z1B3Wwr2RGAa/q1dETPVxByZMslrM54W2XjqXsSmIlXX+xd3Wrq27Urr8TYGKCyc74Zkp758syUze/1RzCgzsoY1km9cvEESdfPlMMz2U/FdxJ+i3k6hE464itRgj/iUpjNmDAZLSoIW354fAvPvT0KMrZQZS0k1RLAPGNygjhpvZAXioliZqdFDuCSYOTZRGhaTKjyG7xePNuIYO357r43xTiAXDznVCuxV4h3jYto8IRaHbEIpiZroaKn07f8Zf5BdpRmWV52lUuL+VNVb+0ds4oFRmQUQ6QoZJFqtDQmWaMmPzdrNFmyoGcDC0TSbf05qGCtm2myquFc84m3WCbwpyjSf2V2pFkJvu3oY1nMT+a6ew3WkN9k3NWL2yN8mPNhE+IFULoeU8NZYGXCrqH7tOQLSsx2C/w5jFbKZZhcigYEdPffpUlIGU30fJYKYsCqjAXBzcYsWMSBAZHLtleI+/Y9xruEqgXCPTIymtvVzha9f8/bxoHfobIfV8j+C6hoKQSYDAqoNZpAYddnfT0AkNTGCdu7pGm6JWelZr07sgXW1Wtbj2ESJ5myY7YQqXfRn02V26DshvvJUiYiz4yI+TtVG2ryeX4NZKglmln8yXMJA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(366004)(39860400002)(346002)(376002)(136003)(451199021)(6512007)(6506007)(4743002)(186003)(478600001)(6666004)(36756003)(235185007)(33964004)(8936002)(5660300002)(44144004)(6486002)(8676002)(44832011)(4326008)(41300700001)(66946007)(2906002)(316002)(66556008)(26005)(86362001)(38100700002)(66476007)(6916009)(2616005)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8349 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 17ba9869-cb32-4e5d-a39e-08db47d4d968 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O3cMvLN0h7Nc7/6bADBC+N5Psd1ej/I0m8UTx0BZnRGwZXHpP/CoqPkg5mWrNtSFmF2hD25tpPmNeDTJX3crLT7jeFVCpcUT0ubxxcJFYpPuaIMSRCDrH9atVIObJ52283cwxvo1XKg2cyLCxzIuUWPXgyZ+Cmcv0PsDJgkRK8bUMtykns0culZVaqz12eqBewyf1p/DEhqXj7SamnedbLZuCNo0qfrWEbU2e5ilCBx9AFYeHXWNx91YR74SyQjZdncGmhxd7Zkc8nGLJRPOIrneEy6VrtjPqGgWz7Ugy6vnjdKcPRrBMWTEBelNAhANcmoTbwVZ/aWyvbpMp0aGU3cbPTr51aosqpoITnMYKQwkE12bRX/Ut2tbO2D+z+rEsrrAuP04l0fswp2pvD+Nvz8fYGsWI05frinsod43bDFkUbOFAtDMvY2/2eg4UN+L/tmwf6UfQOHAUPUQfAqznTQTUaLTT/FDYTGVGyWyD6CVUcKKGecWuOghXp4yYkuBCPEcD+86Wc3WlUlPNANss85AXnbUgdJtqcB4+7pALrg0CV6IGYpyjk9K41aPgvVLTsVRy7ioc8m4Jq8cQtKk0jlc8Y6f5ZQ93C9R158kCbtMM0Qa5I/i81e6sW+5UIKipcJADuRR3k9+zeBH8lOckot0hqvFaHUEDSSR3xrSEVoPNT7KgswZ7BpjpnoD4dlugd9LyDaQa/dn+eB3wxvVFhNUXuPrQxF0Vwi0gKWBGG3xFU0XPR4GiV5mNqH/GqW9W+Q2Nl/t5cESCL87NLYhbT+ySWW+3S62iIusJdrz7oY= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199021)(40470700004)(46966006)(36840700001)(8936002)(8676002)(41300700001)(44144004)(82310400005)(6666004)(70586007)(70206006)(40480700001)(4326008)(316002)(40460700003)(86362001)(478600001)(36756003)(6916009)(36860700001)(34020700004)(44832011)(4743002)(2906002)(186003)(6512007)(26005)(6506007)(47076005)(336012)(2616005)(107886003)(5660300002)(33964004)(81166007)(235185007)(6486002)(356005)(82740400003)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2023 10:39:41.9035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efcdcd8d-3bb2-4da5-fd8d-08db47d4dffd X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7700 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tamar Christina via Gcc-patches From: Tamar Christina Reply-To: Tamar Christina Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, This is a small improvement in QoL codegen for match.pd to save time not re-evaluating the condition for printing debug information in every function. There is a small but consistent runtime and compile time win here. The runtime win comes from not having to do the condition over again, and on Arm plaforms we now use the new test-and-branch support for booleans to only have a single instruction here. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR bootstrap/84402 * genmatch.cc (decision_tree::gen, write_predicate): Generate new debug_dump var. (dt_simplify::gen_1): Use it. --- inline copy of patch -- diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc index 6d62cdea2082d92e5ecc1102c80205115a4e3040..1f52ca2eebc2794159747338babb56c610387f3b 100644 --- diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc index 6d62cdea2082d92e5ecc1102c80205115a4e3040..1f52ca2eebc2794159747338babb56c610387f3b 100644 --- a/gcc/genmatch.cc +++ b/gcc/genmatch.cc @@ -3431,7 +3431,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result) needs_label = true; } - fprintf_indent (f, indent, "if (UNLIKELY (dump_file && (dump_flags & TDF_FOLDING))) " + fprintf_indent (f, indent, "if (UNLIKELY (debug_dump)) " "fprintf (dump_file, \"%s ", s->kind == simplify::SIMPLIFY ? "Applying pattern" : "Matching expression"); @@ -3892,6 +3892,8 @@ decision_tree::gen (FILE *f, bool gimple) } fprintf (f, ")\n{\n"); + fprintf_indent (f, 2, "const bool debug_dump = " + "dump_file && (dump_flags & TDF_FOLDING);\n"); s->s->gen_1 (f, 2, gimple, s->s->s->result); if (gimple) fprintf (f, " return false;\n"); @@ -3937,6 +3939,8 @@ decision_tree::gen (FILE *f, bool gimple) fprintf (f, ", tree _p%d", i); fprintf (f, ")\n"); fprintf (f, "{\n"); + fprintf_indent (f, 2, "const bool debug_dump = " + "dump_file && (dump_flags & TDF_FOLDING);\n"); dop->gen_kids (f, 2, gimple, 0); if (gimple) fprintf (f, " return false;\n"); @@ -4046,6 +4050,8 @@ write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple) gimple ? ", tree (*valueize)(tree) ATTRIBUTE_UNUSED" : ""); /* Conveniently make 'type' available. */ fprintf_indent (f, 2, "const tree type = TREE_TYPE (t);\n"); + fprintf_indent (f, 2, "const bool debug_dump = " + "dump_file && (dump_flags & TDF_FOLDING);\n"); if (!gimple) fprintf_indent (f, 2, "if (TREE_SIDE_EFFECTS (t)) return false;\n"); --- a/gcc/genmatch.cc +++ b/gcc/genmatch.cc @@ -3431,7 +3431,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result) needs_label = true; } - fprintf_indent (f, indent, "if (UNLIKELY (dump_file && (dump_flags & TDF_FOLDING))) " + fprintf_indent (f, indent, "if (UNLIKELY (debug_dump)) " "fprintf (dump_file, \"%s ", s->kind == simplify::SIMPLIFY ? "Applying pattern" : "Matching expression"); @@ -3892,6 +3892,8 @@ decision_tree::gen (FILE *f, bool gimple) } fprintf (f, ")\n{\n"); + fprintf_indent (f, 2, "const bool debug_dump = " + "dump_file && (dump_flags & TDF_FOLDING);\n"); s->s->gen_1 (f, 2, gimple, s->s->s->result); if (gimple) fprintf (f, " return false;\n"); @@ -3937,6 +3939,8 @@ decision_tree::gen (FILE *f, bool gimple) fprintf (f, ", tree _p%d", i); fprintf (f, ")\n"); fprintf (f, "{\n"); + fprintf_indent (f, 2, "const bool debug_dump = " + "dump_file && (dump_flags & TDF_FOLDING);\n"); dop->gen_kids (f, 2, gimple, 0); if (gimple) fprintf (f, " return false;\n"); @@ -4046,6 +4050,8 @@ write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple) gimple ? ", tree (*valueize)(tree) ATTRIBUTE_UNUSED" : ""); /* Conveniently make 'type' available. */ fprintf_indent (f, 2, "const tree type = TREE_TYPE (t);\n"); + fprintf_indent (f, 2, "const bool debug_dump = " + "dump_file && (dump_flags & TDF_FOLDING);\n"); if (!gimple) fprintf_indent (f, 2, "if (TREE_SIDE_EFFECTS (t)) return false;\n");