From patchwork Fri Nov 4 13:57:28 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: 15558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp425731wru; Fri, 4 Nov 2022 07:09:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yS5O6OJzv2lsL1lc+bPiuTOcYsAd/KPCURF5/TKxPO9+87nd9zw+0XpRym0YCqtauEYH9 X-Received: by 2002:a17:907:2715:b0:7ad:ef1e:3bc7 with SMTP id w21-20020a170907271500b007adef1e3bc7mr19442528ejk.580.1667570987238; Fri, 04 Nov 2022 07:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667570987; cv=none; d=google.com; s=arc-20160816; b=KUNYVVWyhQMGsUWmHyypE4ydHQbGUjhMe93fnTxJ24TPte/y1FSItuxGKIrLSsb4AZ 2lWOcQ6Qr1lXJwXUnf55HBOvvwLe1MvXEFtrNhbkeThuEtime5s3SXN048xpzFHZ+aY+ F/6QMoP1phzFCzX4urikdvTsssmD9WbWncUrm04C0zBAcaHwGVpuTytNFlzAirtOTHQ8 PEX0EV7w44MvBIU8mJNau9Ss+zVMSKAdMP1lw4O0UmJSEYvYM4FZzLK2FYsyyO4PIHjJ gxsfPWcvHRJdb192BiXa+ZuJ1dcErIK6J/dV8AUI4C4NEldBhq6eAEhBCmP8H3LDDYlS Deug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=w+4IuUppzW++ArbB0OFaWw7KMmcTZnksan7qiTEDGPs=; b=sfWEeLELxZ93ujxZEinHlHAzrtGJmTrZob1d3VRWMjHyDr30hLcOT7JyLzHlrZSI3u A+XTe13SeADFFDnYkidRFBxVcjxBsHCkqJk2ywkV/Razv8+Mj/Cw+h3afvKEMel31f/5 CGbnRIHQ768KHD3krQM+KEPj5J44zMt+yeRh/ediT4IAEknGEABD2P3feJEYi8fUQfhM cPLMdYChAm6fx+cL6CoQ+4sh7PH+rBvUJ3g6h17j6EwECv6MofWpI2aI9yzZXkQlRS7f 1bA8SAoja+KR9ovgevqmBjExy0IGV4JLF9rrFPTPNIoHBU7XX92tJ7aa6zFqfE9l9b4J hsXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=uCZnuM0+; 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 n4-20020aa7c684000000b0045caa1628c6si4481507edq.216.2022.11.04.07.09.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 07:09:47 -0700 (PDT) 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=uCZnuM0+; 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 391133952520 for ; Fri, 4 Nov 2022 14:02:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 391133952520 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667570558; bh=w+4IuUppzW++ArbB0OFaWw7KMmcTZnksan7qiTEDGPs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=uCZnuM0+U4hcC302PIySzX7yGZI7iMZuWuCJIoay4AC3bcIzp7yHgMR3UGQ1KDJMM 8q5iB58w3Zkcl3nX/DtHZJMKuDBBpVmQQfGAdjaOg50z09MfZi41aBX2wwsdTUhrJO owr9NdHmf7i+qBXjV9ubZe+qKRxxBO1P9vKXOBIY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id E292C3857B99 for ; Fri, 4 Nov 2022 13:57:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E292C3857B99 Received: by mail-wm1-x333.google.com with SMTP id m7-20020a05600c090700b003cf8a105d9eso3220339wmp.5 for ; Fri, 04 Nov 2022 06:57:33 -0700 (PDT) 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=w+4IuUppzW++ArbB0OFaWw7KMmcTZnksan7qiTEDGPs=; b=bRMdawN/FU3iPOpB6KTg9RzXrE3GWX8XA24jDUrGIu04QJgjfhSLOvOrZxsoEjw5nR WtstNmchzYc6ZYNzEIi9vMNpR8TcQ/vlNjKMGDdIoEJ0L1OwD0NGy3bLQVDxt8x147Jg fz6N/96A/tme1R8QABPSKPY62VpTAnm/ls1Ns1TpTAp64zuxf8Y0U2gAdC69Cbq+pAnP yajDTeylQmVDnPmDxzZGfNWc3Wvoxjw49SrSpc5b/6nYqbLVM2W1v6NKCdtcl612sekt KDl21ApqaZmslOzeeG+b8hHrfD9zIQhgENhLrLfjHeFTMWcivavtwFhDeokQXqN0ajcQ dTXQ== X-Gm-Message-State: ACrzQf3NVpx1fp3gIcfkNOLrlvHCFURObQVOH3eV9O8BUUcUoJ6rzm01 2hkKoGwcWpW/aHZhvpHR2UwnDt4QSu6AOA== X-Received: by 2002:a1c:7c03:0:b0:3cf:4969:9bab with SMTP id x3-20020a1c7c03000000b003cf49699babmr23397490wmc.176.1667570252697; Fri, 04 Nov 2022 06:57:32 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id p10-20020a05600c1d8a00b003c6bd91caa5sm3091569wms.17.2022.11.04.06.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 06:57:32 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [COMMITTED] ada: Fix repeated killing of private entity values Date: Fri, 4 Nov 2022 14:57:28 +0100 Message-Id: <20221104135728.86443-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, 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?= Cc: Piotr Trojanek 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?1748574915583045362?= X-GMAIL-MSGID: =?utf-8?q?1748574915583045362?= From: Piotr Trojanek When killing known values of assignable entities we iterated from First_Entity and then again from First_Private_Entity. This second iteration was unnecessary, because the entity chain that starts with First_Entity contains all entities, including the private ones. This is just a performance improvement; the behavior is unchanged. gcc/ada/ * sem_util.adb (Kill_Current_Values): Only iterate from First_Entity through Next_Entity. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 9eeaf7cc05b..28396a4c34b 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -22287,25 +22287,6 @@ package body Sem_Util is procedure Kill_Current_Values (Last_Assignment_Only : Boolean := False) is S : Entity_Id; - procedure Kill_Current_Values_For_Entity_Chain (E : Entity_Id); - -- Clear current value for entity E and all entities chained to E - - ------------------------------------------ - -- Kill_Current_Values_For_Entity_Chain -- - ------------------------------------------ - - procedure Kill_Current_Values_For_Entity_Chain (E : Entity_Id) is - Ent : Entity_Id; - begin - Ent := E; - while Present (Ent) loop - Kill_Current_Values (Ent, Last_Assignment_Only); - Next_Entity (Ent); - end loop; - end Kill_Current_Values_For_Entity_Chain; - - -- Start of processing for Kill_Current_Values - begin -- Kill all saved checks, a special case of killing saved values @@ -22321,16 +22302,15 @@ package body Sem_Util is -- Clear current values of all entities in current scope - Kill_Current_Values_For_Entity_Chain (First_Entity (S)); - - -- If scope is a package, also clear current values of all private - -- entities in the scope. - - if Is_Package_Or_Generic_Package (S) - or else Is_Concurrent_Type (S) - then - Kill_Current_Values_For_Entity_Chain (First_Private_Entity (S)); - end if; + declare + Ent : Entity_Id; + begin + Ent := First_Entity (S); + while Present (Ent) loop + Kill_Current_Values (Ent, Last_Assignment_Only); + Next_Entity (Ent); + end loop; + end; -- If this is a not a subprogram, deal with parents