From patchwork Mon Nov 7 08:40:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 16314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1921597wru; Mon, 7 Nov 2022 00:49:30 -0800 (PST) X-Google-Smtp-Source: AMsMyM41guK9kBfJ7gJXlWpckTANLLxYzwac3TDNhC2lxEsztJBHK+1jg5xyPAE2Av7cRsY5J+Zw X-Received: by 2002:a17:907:a059:b0:78d:1a16:fc5c with SMTP id gz25-20020a170907a05900b0078d1a16fc5cmr47289858ejc.31.1667810969956; Mon, 07 Nov 2022 00:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667810969; cv=none; d=google.com; s=arc-20160816; b=fCYsZAYSXMlOtpBzwQBdEpAlgfqg/7gNTZVhN1NJYlzBqLw+mlUcn0+kFg2QTylFFH Rj+v2ozRnuEgWZl8rub5cXkedTbI2X7BnFGoxd5uIG9RDJaQZ3xa8G7F1sF2+/rdny8T 9yIJKTf+xLL2Hl8jXWzE1hW19QCyqGAtjlBwcuWkcA/PvL/QxfBUvcgcYoVUxpbV14Gg N0VvBE/Kd3wWx1CFWeS45EYDTdpUbYeg5b5d/Um5XfzBmPgrRNwHVZfgqmgDFATmEIZh wei/J1ozCc/XQWSMj2xFfFXHUrzigwr15sW5eNK35sl/MYjvdqEYSl7ftTPY+oYAKuVg /GIg== 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-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=OLfm8PmXELWbnRtNSa4qZ9HB5WBbu32KIjpy63KYMTs=; b=UNd/pxLuBuSlllQJXpJjmUQ9QYPOMz85wwf5GRz4pnGBplivTifebWWohVZfEWq73o OAHWpKaQoHaRvfhaW5YeP8QOz4g5bRKJSCyFAGk9dBoccacIO73c4KbL6IThbo+XoIk/ XXik2+FDFeK39xyML0XaYpvOWy8GwKtzcAeB5u7wBmQ2/tqch3FL+IXnA6hd0oNoocx4 mfKZyLIHHvhK8W0zarhIQVWkAHfzG6P7VeRoQPStS/cdn30Tk1H2r6ejR8AlVFidTvk3 1vzHmWdMTRtE6XdLlODbqc8VEFoVH5wcOPUbFl2HUpUktziE/WvpSjNtBfFes+X41RuK /RCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VxQ0VoyR; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id z8-20020a05640235c800b00462e4cbe815si10165598edc.550.2022.11.07.00.49.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 00:49:29 -0800 (PST) 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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VxQ0VoyR; 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"; 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 1A4133851AAB for ; Mon, 7 Nov 2022 08:44:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A4133851AAB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667810683; bh=OLfm8PmXELWbnRtNSa4qZ9HB5WBbu32KIjpy63KYMTs=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=VxQ0VoyRnvi838faoMdJaUQeNNFqPCWul4CBdA9jN8TsgYLozIXEqPIKKjGu+9K48 bM9BuOW2/B9sv1SnQ6UkNJtX+skOgYUgdBLNyxuOW/sxWicn+NWheYie5G19+zsEpD 72udzBCCSj4KuNo0RImOVbSRFstjdRNhRJ0semLE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 797283857B96 for ; Mon, 7 Nov 2022 08:40:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 797283857B96 Received: by mail-wm1-x32b.google.com with SMTP id ay14-20020a05600c1e0e00b003cf6ab34b61so9126045wmb.2 for ; Mon, 07 Nov 2022 00:40:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OLfm8PmXELWbnRtNSa4qZ9HB5WBbu32KIjpy63KYMTs=; b=BfNkdSJs+gASTMpaZZyGGFXk/gY1Yb+EkwrmIxpQUpymlRpvKNFX9LgMSg3ATC+OoG WyOanbeTbSZl2OyNR77unJdHTDjncKXcm7ewR3M+rbIxgibm5mcmLb6hTxsm/nrix6li nR00pDrr0hiM077XZLXFJciKGKdnQmKIL9CVy99CxUw3D5tsXYbGylbaQhgQlwCKbbts 8JP7M9g7wVSZYIxJZR/cK8LUc9Y+IEmyYke1h3AbwNHPsHats0bausQIj/hBF64GI+KN 9XWYMJaTkhnb+q07bRMwOaJOy1n0YDmpS7V8BrV5da9C7Ma78LiBtguyX9MWt4zNCUF+ N+4A== X-Gm-Message-State: ACrzQf0zPenn5BVCpwn+GFfoSBZukQ6kp0LL8GboXsEYe9euNVMupyiQ 1R+jrPlT6CY0HF816wpE3EHRfUreqMsoQA== X-Received: by 2002:a05:600c:3484:b0:3cf:878c:1d52 with SMTP id a4-20020a05600c348400b003cf878c1d52mr18191040wmq.78.1667810408356; Mon, 07 Nov 2022 00:40:08 -0800 (PST) Received: from poulhies-Precision-5550.lan (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id bn9-20020a056000060900b00228cd9f6349sm6626700wrb.106.2022.11.07.00.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 00:40:07 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Clean up unnecesary call in resolution of overloaded expressions Date: Mon, 7 Nov 2022 09:40:05 +0100 Message-Id: <20221107084005.150919-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= 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?1748826555681721568?= X-GMAIL-MSGID: =?utf-8?q?1748826555681721568?= From: Piotr Trojanek When experimentally enabling frontend inlining by default, the unnecessary call to Comes_From_Predefined_Lib_Unit in Resolve appears to be a performance bottleneck (most likely this call is expensive because it involves a loop over the currently inlined subprograms). Code cleanup; semantics is unaffected. gcc/ada/ * sem_res.adb (Resolve): Only call Comes_From_Predefined_Lib_Unit when its result might be needed. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_res.adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 76750708bca..ea9a03b58e6 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -2370,8 +2370,6 @@ package body Sem_Res is ("prefix must statically denote a non-remote subprogram", N); end if; - From_Lib := Comes_From_Predefined_Lib_Unit (N); - -- If the context is a Remote_Access_To_Subprogram, access attributes -- must be resolved with the corresponding fat pointer. There is no need -- to check for the attribute name since the return type of an @@ -2505,6 +2503,8 @@ package body Sem_Res is -- is compatible with the context (i.e. the type passed to Resolve) else + From_Lib := Comes_From_Predefined_Lib_Unit (N); + -- Loop through possible interpretations Get_First_Interp (N, I, It);