From patchwork Wed Jan 4 17:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 39041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5257354wrt; Wed, 4 Jan 2023 09:16:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXvx6Y/JsbBivTmGDSXBnkzqQUj9f0hSWVm/6/2QhNsCLu2ZLUboRu0TmvSzgxwkJHML8a5V X-Received: by 2002:a17:907:8a24:b0:846:95f9:5b4d with SMTP id sc36-20020a1709078a2400b0084695f95b4dmr53396404ejc.42.1672852605594; Wed, 04 Jan 2023 09:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672852605; cv=none; d=google.com; s=arc-20160816; b=hC4Uf1Gse/wY2AxZlQ1Qv91D5c2hbAVfEStnGvphSfdJbhXSx0PJ96sBLrb86KftfD S8Rkyz7zzEJfaAGdPYzPYrE1Uf6IV+QzpRIzYrjRoO7D00rNbyrKPxbaOTrV8QTKrjSD pn3DDxgXtk09ufe10AWnqWD4PK8CUw9/bvzjaQ5YcA9cg81y+0JRY9aUuLGF+Di998sY y6wWR0BAzssc++Jo852oy/OVFNwqxBf7CTmVQOZkjAw8PLVbMhOew62ULG5NFMhb1qgd t2wNwTrjjf6rh1TpcAYLLwWNrHBs2s9yk7y2aS+Ud1wRc9+FLZX+O6mdow9u/kWo8lF8 raXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=sR658RGq6HeNKS1WlA2LAiIe0s0FuTor/t5/ts94lz4=; b=xWyPI0DW/6TaIX2th8fHPADuiUTVgLI2AVbPiTguMjzHoagRABuy7vH3sF+Gp2GusW z3NlabQJ4AoqK3BABs/QMK5EPSOaH8El79o+2RT3qpBEn4m4OSRacdffXDIp2pDs0AZ6 AWPstuh+l+gaNBd4JFTyg55mH+Ueljz5yaAZNU38bfjuBlN/7thW25XsgZeWRzpFQ4lz vqZ0Moe9o4gTTLVU5xgxPLponeCsQ3GM4PZAdQR1V28ybsn0h+Lf2T2ZSuHZUXQSIAv/ Jv6dKp0jrIRS+zQIIaLDrcrpmZrMQAkrNdgfyeMZRvHPYE5ZclPfYBIeLKPLN/lr02Sc GA3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tz7b5XCT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v17-20020a056402349100b0046afd9f07b0si34294071edc.14.2023.01.04.09.16.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:16:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tz7b5XCT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BE0C53858417 for ; Wed, 4 Jan 2023 17:16:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE0C53858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672852570; bh=sR658RGq6HeNKS1WlA2LAiIe0s0FuTor/t5/ts94lz4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tz7b5XCTmaMszYY/rOZEjkhVETi9kHt0z+shCx4m+4+DXNJPCPfA8NqJE/XioumCa 5hE1s2akCzF4xK9mhNGNJp3uBviARwsdnCHmNHJyCjRTf2TjjA8RbEW52HJcrCI0JU x5iSsOq1aS/etgXPGSJYLaBhwV5MTba4bxVj++vo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 792A5284AED; Wed, 4 Jan 2023 18:15:25 +0100 (CET) Date: Wed, 4 Jan 2023 18:15:25 +0100 To: gcc-patches@gcc.gnu.org, mjambor@suse.cz Subject: Avoid quadratic behaviour of symbol renaming Message-ID: MIME-Version: 1.0 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 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: Jan Hubicka via Gcc-patches From: Jan Hubicka Reply-To: Jan Hubicka Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754113093620312231?= X-GMAIL-MSGID: =?utf-8?q?1754113093620312231?= 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