From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 333F438576BD; Fri, 4 Nov 2022 13:54:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 333F438576BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667570078; bh=QAlbj2oIR/do1p5Dj3UqNmxeSWnfEw0rRxMXcmoRTbs=; h=From:To:Subject:Date:From; b=odCuDcx2LaqQ1JMQ/M/LdYHTRHktAiCo85uSTvWBu3gV65+xGH3IBbFdrEKZB5bIF 76E09hjc4WQf2FTci2Y3pLHHPhKMHSnCGFulpz3RGIq/nEhs1eCpdKEnq9ul7wYcZj cPtp3zGeNb+sozZ0pwY4su3611RUaULs6c0zCqrI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3670] ada: Fix repeated killing of private entity values X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 50bd9f4e6fc7ac84b5d0f29b76dff1f82381ee38 X-Git-Newrev: 73d04a073b7288fcf6fc2e1f25d8b1f3a2c6fb81 Message-Id: <20221104135438.333F438576BD@sourceware.org> Date: Fri, 4 Nov 2022 13:54:38 +0000 (GMT) List-Id: https://gcc.gnu.org/g:73d04a073b7288fcf6fc2e1f25d8b1f3a2c6fb81 commit r13-3670-g73d04a073b7288fcf6fc2e1f25d8b1f3a2c6fb81 Author: Piotr Trojanek Date: Fri Oct 7 12:55:14 2022 +0200 ada: Fix repeated killing of private entity values 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. Diff: --- 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