From patchwork Mon Sep 18 14:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 141436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2714637vqi; Mon, 18 Sep 2023 07:47:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzux0tVd0mSRPWi4YDC7NWKNQjQD+o/9OcmJ/X9ax2hV4PJq6EoLmxVYgb+ETIBXrafBmy X-Received: by 2002:a05:6512:3da0:b0:503:1be5:24eb with SMTP id k32-20020a0565123da000b005031be524ebmr2419682lfv.50.1695048446585; Mon, 18 Sep 2023 07:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695048446; cv=none; d=google.com; s=arc-20160816; b=IYo/jhHjyDIKLs+QNvhq3LyxR8b6sep0xXYUKwBZd5+RmsS0AX+HMmNJosb702/6yi Rn1vAcu0SsG5p4eGfu7fjUNGSRoizL/Uvjbh6xup4dHt+q+H8kky4ZuViYBjLycyXslf PRfqYyZM0LpNnhnML69y1+Hs05aA8s/TVIwxYiyjjqNAQ4K89DBU6EobVTgOzs++c7ds jnVjxrs30Dc7DBSBqDv9s6hbudlueLnR6wqmqJxege2At10QhHpXZffO7OPadnmQEzg3 Z/3niXUTXMq5o8/l0l5cMwU/EODYh5L9IJ7GTWICEDhxRyfSMcaz5j6COo58iODpOQX1 JL/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=xKFJrjpYWEGDneRLDpfQKxMcVHhei5AIF90n9pqS4+g=; fh=brlCiXDaqh+DCvdS2mliWDx2ljU3hDoizvnXgbQgiVQ=; b=IzxLRjvLZ7QPHY6wVb5W4JqGn+sl5J+DSYpCOWJCq65EwDgRsg8vUXajJ6f6Wue1zT sZmBuOP6mKFDl2B03Wcfj+Om3uIF+1OMyjKFi5lHVslARLpwgm+VMYStXCLE7qEJNpEJ 1J23/QruKVvIaHzA4a6imd/TpL342ZTrr0WZ7d3horLpTexPePM+zcxLDTLedD56v54p AfgV5tSsepypTAKmC90fYHZR1YMB57JiuBwhNAny0tJ7Z5z3QTkMmIWlBF9Jj5yL6Zuw Bu75zMoBT30elbP9ReOiGnDVNEOBsp4GG0iQ+ritFLVLBFk2P7sV9W0p52XnsgtySVKJ PuUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w22-20020aa7da56000000b005255a7da1cfsi8284773eds.134.2023.09.18.07.47.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 07:47:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B34C38582B7 for ; Mon, 18 Sep 2023 14:47:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id E8AEF3858C78 for ; Mon, 18 Sep 2023 14:46:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E8AEF3858C78 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-CSE-ConnectionGUID: gj0ThJuHTb6PokNneCBW6A== X-CSE-MsgGUID: iSEB+4q5Sw2mqUqpc95c9A== X-IronPort-AV: E=Sophos;i="6.02,156,1688457600"; d="scan'208,223";a="17183990" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 18 Sep 2023 06:46:38 -0800 IronPort-SDR: SZGlY3fCfdCnsttJV7PsGFHN5cO6ppcFxeN3KMq6/GQwsuykH3qnzfYC20ogrcwc269JA21tNd XQTQ38NkqEXFF/L1bAZXo7NiKUvsDjovk6GGD7OQbXVbglFhkCf/l4B44UVftCHc10VDQmSL+B VXnQMEh8Nc0Qss0m3O8gLjbdCRBxymOclJ7TvahgEfhbDYkT2K3HmaPZGjHoMtCEMAmPOlv5DS Lhum2Pf8SXpU3pp340B+XluAJgEnHtT4S6wxwuMZGqeMx9pUGzyaTEH2vsWx7Xgkz5zMMEj7Lw 4tg= From: Thomas Schwinge To: , Robin Dapp , , Richard Biener , "Jakub Jelinek" CC: , , Jeff Law , , Subject: LTO: Get rid of 'lto_mode_identity_table' (was: Machine Mode ICE in RISC-V when LTO) In-Reply-To: <8c55be5d-3a6a-18bd-a054-072ecb28b949@gmail.com> References: <87o7kxuq9s.fsf@euler.schwinge.homeip.net> <878rajuj3a.fsf@dem-tschwing-1.ger.mentorg.com> <8c55be5d-3a6a-18bd-a054-072ecb28b949@gmail.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Mon, 18 Sep 2023 16:46:29 +0200 Message-ID: <87il87bku2.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777387120309478613 X-GMAIL-MSGID: 1777387120309478613 Hi! On 2023-09-15T15:33:59+0200, Robin Dapp wrote: > is there anything we can do to assist from the riscv side in order to help > with this? I haven't really been involved with it but was wondering > what's missing. If I understand correctly Thomas has a major cleanup > operation in plan Not really major, but indeed non-trivial -- but WIP already. ;-) > but might not get to it soon. Right. > The fix he proposed > helps for the riscv case, however, even without the rework? Right, and no harm done for my work. > If so, I'd kindly ping Jakub to check if the fix is reasonable. I'll push the attached "LTO: Get rid of 'lto_mode_identity_table'" mid-week, unless any objections raised. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From f88a923d7e3e26c29630f1b20624fa54032f8e96 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 10 Aug 2023 15:23:37 +0200 Subject: [PATCH] LTO: Get rid of 'lto_mode_identity_table' This, in particular, resolves LTO ICEs with big 'machine_mode's, as for RISC-V. ('mode_table' in 'lto_file_decl_data' still is 'unsigned char'; changing that is still to be done (for use in offloading compilation), but is not trivial.) For now, get rid of 'lto_mode_identity_table' to resolve the RISC-V LTO ICEs; we don't need an actual table for a 1-to-1 mapping. gcc/lto/ * lto-common.cc (lto_mode_identity_table): Remove. (lto_file_finalize) [!ACCEL_COMPILER]: 'NULL'-intialize 'file_data->mode_table'. (lto_fe_init): Don't initialize 'lto_mode_identity_table'. * lto-common.h (lto_mode_identity_table): Remove. gcc/ * tree-streamer.h (bp_unpack_machine_mode): If 'ib->file_data->mode_table' not available, apply 1-to-1 mapping. Co-authored-by: Pan Li --- gcc/lto/lto-common.cc | 11 +---------- gcc/lto/lto-common.h | 1 - gcc/tree-streamer.h | 5 ++++- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index 703e665b698..ad6e7fde5ce 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -64,8 +64,6 @@ static bool type_streaming_finished = false; GTY(()) tree first_personality_decl; -GTY(()) const unsigned char *lto_mode_identity_table; - /* Returns a hash code for P. */ static hashval_t @@ -2277,7 +2275,7 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file, #ifdef ACCEL_COMPILER lto_input_mode_table (file_data); #else - file_data->mode_table = lto_mode_identity_table; + file_data->mode_table = NULL; file_data->mode_bits = ceil_log2 (MAX_MACHINE_MODE); #endif @@ -3118,13 +3116,6 @@ lto_fe_init (void) memset (<o_stats, 0, sizeof (lto_stats)); bitmap_obstack_initialize (NULL); gimple_register_cfg_hooks (); -#ifndef ACCEL_COMPILER - unsigned char *table - = ggc_vec_alloc (MAX_MACHINE_MODE); - for (int m = 0; m < MAX_MACHINE_MODE; m++) - table[m] = m; - lto_mode_identity_table = table; -#endif } #include "gt-lto-lto-common.h" diff --git a/gcc/lto/lto-common.h b/gcc/lto/lto-common.h index 24b2445673b..b9faa72e5cb 100644 --- a/gcc/lto/lto-common.h +++ b/gcc/lto/lto-common.h @@ -26,7 +26,6 @@ void print_lto_report_1 (void); extern tree lto_eh_personality_decl; extern GTY(()) vec *tree_with_vars; -extern const unsigned char *lto_mode_identity_table; extern tree first_personality_decl; #endif diff --git a/gcc/tree-streamer.h b/gcc/tree-streamer.h index ff49d1ba637..886ee6ac754 100644 --- a/gcc/tree-streamer.h +++ b/gcc/tree-streamer.h @@ -118,7 +118,10 @@ bp_unpack_machine_mode (struct bitpack_d *bp) lto_input_block *ib = (class lto_input_block *) bp->stream; int last = 1 << ib->file_data->mode_bits; unsigned ix = bp_unpack_enum (bp, machine_mode, last); - return (machine_mode) ib->file_data->mode_table[ix]; + if (ib->file_data->mode_table) + return (machine_mode) ib->file_data->mode_table[ix]; + else + return (machine_mode) ix; } #endif /* GCC_TREE_STREAMER_H */ -- 2.34.1