From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x32b.google.com with SMTP id ay14-20020a05600c1e0e00b003cf6ab34b61so9126045wmb.2 for ; Mon, 07 Nov 2022 00:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OLfm8PmXELWbnRtNSa4qZ9HB5WBbu32KIjpy63KYMTs=; b=WMJW86IalVkjqsPu1NqNGyFPodets3capa0V1cO9pS1ua1iigi9tRSBYvmk/Tjw/Ko TyAuBLKRD3JZo9B38qxsHFZUOu4QmQ8PqCrWvgYnfdb0FdP9y2i9I1dq28AgNnRNVUld qrnI5br2bARzhIklIEN/mlsFNSYDRAErY7IeEulrxbOcX3rGNDt2QdSBLOiy0nAnMsni vtV47jkH8VAi7gG4TdFkdmK3XvAbSOV8Y7M5PmF2fGy1QJXgtEaKow3AqFQ7y9oQfTut TsDijtkKDLYv7z+iF/wasd5Cgdeex30apv+5XAtAO3dyUTn14S+Jw2+H7r2WoWwJC2z2 jivA== 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-Google-Smtp-Source: AMsMyM4rfW+AmjMYyUmGeNhpzreiacACiD41qZT2QwfZvwqYssGid31sB3dIQ9yV/Qj9q+wFRwzY3A== 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) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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); -- 2.34.1