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: 1721465 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=DVWn1jM7; 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 4NnGTJ32m1z23fc for ; Thu, 5 Jan 2023 04:15:48 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6472B3858C2D for ; Wed, 4 Jan 2023 17:15:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6472B3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672852546; 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=DVWn1jM7Y3Pn89QaB3NHDirLh+K3tIzmudifnHVUhE7FIu+lsc8UZRO05Gd3lNz9a Bznp6X6mNU603ic551mKpEGa2jWlQEJTKKFWK0+8HkbJSEDIO9k4PfP126p5YX4dL+ /8SfCLBqAHhc/r0j/+r4A7ZVORGd3THqSfltDJjY= 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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