From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id E75A43857026 for ; Wed, 4 Jan 2023 17:15:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E75A43857026 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 792A5284AED; Wed, 4 Jan 2023 18:15:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1672852525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=sR658RGq6HeNKS1WlA2LAiIe0s0FuTor/t5/ts94lz4=; b=eg9bW2sWKVW8wCMwaHW3NyELZR1KufuFfBGE47dlGUhCalzIAL0hnVEkbrsYfkNaeEwpih KEoYCrTR7lwnATYGY/GWaGcJvcbsQk1kiy+2Sy5E3uAD7lpD00P3EmWr/UWP4HrePOtogl Di2f2offAF0RK0Qp1Nc0O8v/SYyVoBc= Date: Wed, 4 Jan 2023 18:15:25 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, mjambor@suse.cz Subject: Avoid quadratic behaviour of symbol renaming Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: Hi, LTO partitioning does renaming of symbols that ends up in same partition and clash with assembler name. This is done for "ordinary" symbols (such as static functions) but also for symbols that are kept only as master clones holding bodies of functions to be specialized later. This is done only becuase we stream bodies to named section and clash in names would mean that ltrans will load wrong body and crash. Martin recently added bit to stream body for clones that are needed since this makes it easier to bookeep what summaries are output. THis however triggers mass renaming of inline clones that is very slow and unnecesary since their bodies are never streamed. Bootstrapped/regtested x86_64-linux, comitted. gcc/lto/ChangeLog: 2023-01-04 Jan Hubicka * lto-partition.cc (may_need_named_section_p): Clones with no body need no remaning. diff --git a/gcc/lto/lto-partition.cc b/gcc/lto/lto-partition.cc index 654d67f272e..b96d1dd473d 100644 --- a/gcc/lto/lto-partition.cc +++ b/gcc/lto/lto-partition.cc @@ -1035,15 +1035,18 @@ promote_symbol (symtab_node *node) /* Return true if NODE needs named section even if it won't land in the partition symbol table. - FIXME: we should really not use named sections for inline clones - and master clones. */ + FIXME: we should really not use named sections for master clones. */ static bool may_need_named_section_p (lto_symtab_encoder_t encoder, symtab_node *node) { struct cgraph_node *cnode = dyn_cast (node); + /* We do not need to handle variables since we never clone them. */ if (!cnode) return false; + /* Only master clones will have bodies streamed. */ + if (cnode->clone_of) + return false; if (node->real_symbol_p ()) return false; return (!encoder