From patchwork Fri Mar 25 15:07:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1609463 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=Sg/Z5ZZ8; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KQ58C6Tqhz9s07 for ; Sat, 26 Mar 2022 02:08:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC5FE3888C7E for ; Fri, 25 Mar 2022 15:08:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC5FE3888C7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1648220919; bh=5unzeSIW9RDN388RWc64nt8qgH5oOVizq6tx1aGBWjQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Sg/Z5ZZ8VmI+bl0rSwasJ+mRspnnAVTtvngPf/+9ppNdclwr1SyFttRTl2Y/n3Vl3 2QYuWVfAYQ4zCyms1dhF6Ntlwqw2nMYXwsuQtB6fFcjT2P8AU2GRknHIINEJUubdmR SQjp3jZ+Uefe1n1I08FG5VBg5Ovy607emasHbeuU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70047.outbound.protection.outlook.com [40.107.7.47]) by sourceware.org (Postfix) with ESMTPS id 5452A3857404 for ; Fri, 25 Mar 2022 15:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5452A3857404 Received: from DB9PR02CA0003.eurprd02.prod.outlook.com (2603:10a6:10:1d9::8) by PAXPR08MB6654.eurprd08.prod.outlook.com (2603:10a6:102:15e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18; Fri, 25 Mar 2022 15:08:09 +0000 Received: from DB5EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::72) by DB9PR02CA0003.outlook.office365.com (2603:10a6:10:1d9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17 via Frontend Transport; Fri, 25 Mar 2022 15:08:09 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT011.mail.protection.outlook.com (10.152.20.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18 via Frontend Transport; Fri, 25 Mar 2022 15:08:08 +0000 Received: ("Tessian outbound 2877e54fe176:v113"); Fri, 25 Mar 2022 15:08:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c8032a92fc6d61c7 X-CR-MTA-TID: 64aa7808 Received: from 79ab29875962.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2A5A9D92-26F7-4E18-80CE-8BF0DE8BA73F.1; Fri, 25 Mar 2022 15:08:02 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 79ab29875962.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 25 Mar 2022 15:08:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VKXs/LzcyIRV1Oj3BYskSg3YDTNLBPgGTTIAzX7zauF41g3uFhQGAHC+V0eSfqvRnkhLfzfeZaA2PAEVAdXdvWRxI6A4dV7RwX0MFOYCqC9yNPQmvjU96KtWSB8b/IcGPnujBG3YHb+YaWh9ihzZYm07DkwK8KvOcIpBe4mQi0gxvS1NYyCGKN8TdWWWnUEBta26IJ6TicYVqxCeJVWCK7w9RhBUCqNXTZzgDY8TehkeM4R0rUrccoMK1KOGB3ra/MykolP008mJS5zluA86UxsAZle2AhlFqhfV/49XrnXIjlLlD2uj6mEdkynB4J+HmfCrU5UC7nrmgQNiUROgIA== 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=5unzeSIW9RDN388RWc64nt8qgH5oOVizq6tx1aGBWjQ=; b=LT1Nw25IJIothjhTNOXD609Es7LsOXYRBLImBkYI9SiYLovXzMeIUKNLPL5urhUA6HcAh7Ud9MHTimMcaA6oYB8IJBa8tz7sCKxUN2s2CfmdMWUD3Z4WRCMMv7VAF++LZqVO+eMH5NCNN6viBJxoqTh5B5SyNBXYoKiM2aW/9ofM+YyknZUmhnpQqM1UwtASLJkOxZTycplnHKdFEfjkaAw1Sa/TEgQPF50lxWIhDZCq0blQ9rYP/r2ZVNiukxaYsq0J3tfMFMBoqOrLd2RqZfc/c1c295B2G4N4LZ0W+LW823bl0PjuCZbOIc37xmq6owTMUlo+Yc1t8hkU2F13ww== 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 PAXPR08MB7201.eurprd08.prod.outlook.com (2603:10a6:102:208::18) by DBAPR08MB5589.eurprd08.prod.outlook.com (2603:10a6:10:1a2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Fri, 25 Mar 2022 15:08:00 +0000 Received: from PAXPR08MB7201.eurprd08.prod.outlook.com ([fe80::8467:33e9:2c4b:c7b7]) by PAXPR08MB7201.eurprd08.prod.outlook.com ([fe80::8467:33e9:2c4b:c7b7%7]) with mapi id 15.20.5038.015; Fri, 25 Mar 2022 15:08:00 +0000 Date: Fri, 25 Mar 2022 15:07:46 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH][GCC 13] Enable match.pd dumping with -fdump-tree-original Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO2P123CA0047.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::35) To PAXPR08MB7201.eurprd08.prod.outlook.com (2603:10a6:102:208::18) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 6401fee6-1026-47e7-adb9-08da0e7145a3 X-MS-TrafficTypeDiagnostic: DBAPR08MB5589:EE_|DB5EUR03FT011:EE_|PAXPR08MB6654:EE_ X-Microsoft-Antispam-PRVS: 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: 9tWdOZIM3XAE4I99N11xcyLKlqv5bCQUcw6oD7VHiEApNQ/vjweC4G3bTsqsY3ji0YY3wzJTfIN5WRCDAtVid/cOJfhWU85NJwPuYuRthZAIoYnyFZtMQpl/3uwycpNqFBohBpaUmvMMIwjPt7Vi5XCK8efixHRix8gIeUlD7wZ2ek59ckjrGUd1hJArlcTFnhNtpTwXpw4UAY/tExOyu06CRzqff9BydjwuJOg5EnmuJVm6URuXd+pbzXlq1S+zS21FT7E8ozBV/1mpQlxK0hNVt0nQEMXPLeF9e8diyX8Oyhp1TK5gzJ89sbbhPoL3D3gew61TOMSNc1WLuJ4mtmRqzttHJ4RGmowIT5JasMvzG/X1L89wwyxQTC9WcQCpsP3XlYN/j3x+M9bO7Ti/jzb/2QBKWtd1IN3i72JIlCJSoTH0Qrqr2+WSMYPRtIiRx5fvNPmKa2wOJrvPfqzKfW4mitXSWMEThQfLEryhYy6RMj2rE2UespLWDFbP6n9rDriRO3jSbM6faTR1zMhOHkE9Z7jxPT9sQjrRrzhDjtfb2PE6G2zWZabJfk+ML457fWDGLsBGBTirR0caBINcqAPolNZ5sf9U+BkgSRdJPAvVebxr6vBeh4ve6QdrMfpCbTDkQruA2jFLe4dgVQ8ASmdQpORHyCFX9lHkfmEXdsBDjOES3OMkt63CNrSorrBhgguJmw47maCV6O8Djj3pLg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR08MB7201.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(66556008)(66476007)(2616005)(66946007)(26005)(83380400001)(38100700002)(36756003)(8676002)(6512007)(33964004)(44144004)(6666004)(6916009)(6506007)(316002)(8936002)(44832011)(21480400003)(2906002)(6486002)(508600001)(5660300002)(235185007)(186003)(86362001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5589 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: DB5EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 869f1ec0-33cf-468e-c327-08da0e714063 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FeHtyjN51rEk8/qRWQcm7YTu4JjGPvvwkuTXehZgaJQvr9s8ZDK04m6lJHKzqLYEFx7qxHULUVEJOrO/AzFPwiD6lAyRJNPAUojDbPy33TFaJa7Yxq4aOc+nfsIUWyhjqm0cL+6eYJaLTmpJ8Anzyy0IOsk6DEpE53aRUzwx1KxMeKhatlUij0l1eqiF6y6J3x/V9xB8Zty2GqOa9hg/lnUFj5O8HSURorNnS9ZO8Sg8o6TkaVAsRiWR5JpGCMiWJtDEzxnXn6cdm8jshFoLvqtmP9Zxvd7Ws86SAmSo/sC2aVCW1u2hgjSQs65TRLNydSbUT1FbfVjUfzfGezhvZm4vyLO3gPe/NXk5p0QHq+flWA0h2K62Gbshn5NWHvklQvU03xreYnRt1j5XZsrVKDmFYl8gHBs+Zz+ozKh+ngY68hzzMr/3n2ABIDiEfTksOY87DjZzD7SOh4UqwlsWPVMNDd4UrkP9uIIw/7xF0mppSkVDqQcERf5eIII9bUn46OFL/dfGXD3Ip0hytBv1fLxt9JtGHEEwVp6uAgEdCTgFL4TedFhijYeAsb48kXloWsTuaAD3GuBWUbr9XGIZ1GGHlO/MydJV5u7ryo0ZrCXwLWjsM3RNwIymWTACM/3BXoRXUOaU+WKT8YN++8WOEtD31cZDBSYmX3o1mLCW7wcnhGg5gGel6fj9f4m+v9mk/jaQJMVAXdbISSLOz22+Tw== 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:(13230001)(4636009)(36840700001)(40470700004)(46966006)(2906002)(83380400001)(44144004)(6666004)(81166007)(508600001)(44832011)(235185007)(6512007)(356005)(33964004)(6486002)(8936002)(36860700001)(40460700003)(5660300002)(36756003)(86362001)(316002)(186003)(8676002)(6916009)(6506007)(82310400004)(70206006)(47076005)(70586007)(26005)(336012)(21480400003)(2616005)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2022 15:08:08.8704 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6401fee6-1026-47e7-adb9-08da0e7145a3 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: DB5EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6654 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Alex Coplan via Gcc-patches From: Alex Coplan Reply-To: Alex Coplan Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, I noticed that, while the C/C++ frontends invoke the GENERIC match.pd simplifications to do early folding, the debug output from generic-match.cc does not appear in the -fdump-tree-original output, even with -fdump-tree-original-folding or -fdump-tree-original-all. This patch fixes that. For example, before the patch, for the following code: int a[2]; void bar (); void f() { if ((unsigned long)(a + 1) == 0) bar (); } on AArch64 at -O0, -fdump-tree-original-all would give: ;; Function f (null) ;; enabled by -tree-original { if (0) { bar (); } } After the patch, we get: Applying pattern match.pd:3774, generic-match.cc:24535 Matching expression match.pd:146, generic-match.cc:23 Applying pattern match.pd:5638, generic-match.cc:13388 ;; Function f (null) ;; enabled by -tree-original { if (0) { bar (); } } The reason we don't get the match.pd output as it stands, is that the original dump is treated specially in c-opts.cc: it gets its own state which is independent from that used by other dump files in the compiler. Like most of the compiler, the generated generic-match.cc has code of the form: if (dump_file && (dump_flags & TDF_FOLDING)) fprintf (dump_file, ...); But, as it stands, -fdump-tree-original has its own FILE * and flags in c-opts.cc (original_dump_{file,flags}) and never touches the global dump_{file,flags} (managed by dumpfile.{h,cc}). This patch adjusts the code in c-opts.cc to use the main dump infrastructure used by the rest of the compiler, instead of treating the original dump specially. We take the opportunity to make a small refactor: the code in c-gimplify.cc:c_genericize can, with this change, use the global dump infrastructure to get the original dump file and flags instead of using the bespoke get_dump_info function implemented in c-opts.cc. With this change, we remove the only use of get_dump_info, so this can be removed. Note that we also fix a leak of the original dump file in c_common_parse_file. I originally thought it might be possible to achieve this with only one static call to dump_finish () (by simply moving it earlier in the loop), but unfortunately the dump file is required to be open while c_parse_final_cleanups runs, as we (e.g.) perform some template instantiations here for C++, which need to appear in the original dump file. We adjust cgraph_node::get_create to avoid introducing noise in the original dump file: without this, these "Introduced new external node" lines start appearing in the original dump files, which breaks tests that do a scan-tree-dump-times on the original dump looking for a certain function name. Bootstrapped/regtested on aarch64-linux-gnu, OK for GCC 13? Thanks, Alex gcc/c-family/ChangeLog: * c-common.h (get_dump_info): Delete. * c-gimplify.cc (c_genericize): Get TDI_original dump file info from the global dump_manager instead of the (now obsolete) get_dump_info. * c-opts.cc (original_dump_file): Delete. (original_dump_flags): Delete. (c_common_parse_file): Switch to using global dump_manager to manage the original dump file; fix leak of dump file. (get_dump_info): Delete. gcc/ChangeLog: * cgraph.cc (cgraph_node::get_create): Don't dump if the current dump file is that of -fdump-tree-original. diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 52a85bfb783..b829cdbfe28 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -950,7 +950,6 @@ extern bool c_common_post_options (const char **); extern bool c_common_init (void); extern void c_common_finish (void); extern void c_common_parse_file (void); -extern FILE *get_dump_info (int, dump_flags_t *); extern alias_set_type c_common_get_alias_set (tree); extern void c_register_builtin_type (tree, const char*); extern bool c_promoting_integer_type_p (const_tree); diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc index a00b0a02dcc..a6f26c9b0d3 100644 --- a/gcc/c-family/c-gimplify.cc +++ b/gcc/c-family/c-gimplify.cc @@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "c-ubsan.h" #include "tree-nested.h" +#include "context.h" /* The gimplification pass converts the language-dependent trees (ld-trees) emitted by the parser into language-independent trees @@ -552,6 +553,7 @@ c_genericize_control_r (tree *stmt_p, int *walk_subtrees, void *data) void c_genericize (tree fndecl) { + dump_file_info *dfi; FILE *dump_orig; dump_flags_t local_dump_flags; struct cgraph_node *cgn; @@ -581,7 +583,9 @@ c_genericize (tree fndecl) do_warn_duplicated_branches_r, NULL); /* Dump the C-specific tree IR. */ - dump_orig = get_dump_info (TDI_original, &local_dump_flags); + dfi = g->get_dumps ()->get_dump_file_info (TDI_original); + dump_orig = dfi->pstream; + local_dump_flags = dfi->pflags; if (dump_orig) { fprintf (dump_orig, "\n;; Function %s", diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index a341a061758..09a16b20f36 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "mkdeps.h" #include "dumpfile.h" #include "file-prefix-map.h" /* add_*_prefix_map() */ +#include "context.h" #ifndef DOLLARS_IN_IDENTIFIERS # define DOLLARS_IN_IDENTIFIERS true @@ -100,10 +101,6 @@ static size_t deferred_count; /* Number of deferred options scanned for -include. */ static size_t include_cursor; -/* Dump files/flags to use during parsing. */ -static FILE *original_dump_file = NULL; -static dump_flags_t original_dump_flags; - /* Whether any standard preincluded header has been preincluded. */ static bool done_preinclude; @@ -1226,15 +1223,13 @@ c_common_init (void) void c_common_parse_file (void) { - unsigned int i; - - i = 0; - for (;;) + auto dumps = g->get_dumps (); + for (unsigned int i = 0;;) { c_finish_options (); /* Open the dump file to use for the original dump output here, to be used during parsing for the current file. */ - original_dump_file = dump_begin (TDI_original, &original_dump_flags); + dumps->dump_start (TDI_original, &dump_flags); pch_init (); push_file_scope (); c_parse_file (); @@ -1248,29 +1243,15 @@ c_common_parse_file (void) cpp_clear_file_cache (parse_in); this_input_filename = cpp_read_main_file (parse_in, in_fnames[i]); - if (original_dump_file) - { - dump_end (TDI_original, original_dump_file); - original_dump_file = NULL; - } /* If an input file is missing, abandon further compilation. cpplib has issued a diagnostic. */ if (!this_input_filename) break; + dumps->dump_finish (TDI_original); } c_parse_final_cleanups (); -} - -/* Returns the appropriate dump file for PHASE to dump with FLAGS. */ - -FILE * -get_dump_info (int phase, dump_flags_t *flags) -{ - gcc_assert (phase == TDI_original); - - *flags = original_dump_flags; - return original_dump_file; + dumps->dump_finish (TDI_original); } /* Common finish hook for the C, ObjC and C++ front ends. */ diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index b923a59ab0c..10786b1e372 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -537,6 +537,11 @@ cgraph_node::get_create (tree decl) return first_clone; cgraph_node *node = cgraph_node::create (decl); + + /* Avoid noise in -fdump-tree-original dump file. */ + const bool should_dump = dump_file + && !g->get_dumps ()->get_dump_file_info (TDI_original)->pstate; + if (first_clone) { first_clone->clone_of = node; @@ -544,12 +549,12 @@ cgraph_node::get_create (tree decl) node->order = first_clone->order; symtab->symtab_prevail_in_asm_name_hash (node); node->decl->decl_with_vis.symtab_node = node; - if (dump_file) + if (should_dump) fprintf (dump_file, "Introduced new external node " "(%s) and turned into root of the clone tree.\n", node->dump_name ()); } - else if (dump_file) + else if (should_dump) fprintf (dump_file, "Introduced new external node " "(%s).\n", node->dump_name ()); return node;