From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1075) id 4A6443858D35; Wed, 4 Jan 2023 17:13:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A6443858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672852433; bh=kJjtPhEdyPwfLu2JIOQZpSDmKu7RobfYP5zCle5ojjQ=; h=From:To:Subject:Date:From; b=JQ0BmTKo2PvYsDkrb/nh9CopMcnttHrbvTapfame3imd8mug8rUCyMt0Cq17BVPjb bAqSQh952nwVQ5MHQ5BEGifOL14sNootH3G/PAPkFHH7xPw71pabo1c1tqokzUlaFG yyv1Uu+ZELejtMUwhZLI97Bl6p9AXHINy32+Z7O0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jan Hubicka To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4998] Avoid quadratic behaviour of LTO symbol promotion X-Act-Checkin: gcc X-Git-Author: Jan Hubicka X-Git-Refname: refs/heads/master X-Git-Oldrev: 96cba8ebe512887025a9e8b74833074d8aa844c8 X-Git-Newrev: edc038863d88ef0fe7c3ffb3703a9d2b3a17f0a9 Message-Id: <20230104171353.4A6443858D35@sourceware.org> Date: Wed, 4 Jan 2023 17:13:53 +0000 (GMT) List-Id: https://gcc.gnu.org/g:edc038863d88ef0fe7c3ffb3703a9d2b3a17f0a9 commit r13-4998-gedc038863d88ef0fe7c3ffb3703a9d2b3a17f0a9 Author: Jan Hubicka Date: Wed Jan 4 18:03:53 2023 +0100 Avoid quadratic behaviour of LTO symbol promotion 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: --- gcc/lto/lto-partition.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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