public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1282] ada: Simplify expansion of set membership Date: Fri, 26 May 2023 07:37:25 +0000 (GMT) [thread overview] Message-ID: <20230526073725.5CEF5384D19F@sourceware.org> (raw) https://gcc.gnu.org/g:d97ab77cc828c48a6d0dca6f955e91a77f40dbf9 commit r14-1282-gd97ab77cc828c48a6d0dca6f955e91a77f40dbf9 Author: Piotr Trojanek <trojanek@adacore.com> Date: Fri Mar 24 18:09:48 2023 +0100 ada: Simplify expansion of set membership Code cleanup; semantics is unaffected. gcc/ada/ * exp_ch4.adb (Expand_Set_Membership): Simplify by using Evolve_Or_Else. Diff: --- gcc/ada/exp_ch4.adb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 438cd45ef0e..f894da58888 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -13198,8 +13198,6 @@ package body Exp_Ch4 is procedure Expand_Set_Membership (N : Node_Id) is Lop : constant Node_Id := Left_Opnd (N); - Alt : Node_Id; - Res : Node_Id; function Make_Cond (Alt : Node_Id) return Node_Id; -- If the alternative is a subtype mark, create a simple membership @@ -13228,23 +13226,22 @@ package body Exp_Ch4 is return Cond; end Make_Cond; + -- Local variables + + Alt : Node_Id; + Res : Node_Id := Empty; + -- Start of processing for Expand_Set_Membership begin Remove_Side_Effects (Lop); - Alt := First (Alternatives (N)); - Res := Make_Cond (Alt); - Next (Alt); - -- We use left associativity as in the equivalent boolean case. This -- kind of canonicalization helps the optimizer of the code generator. + Alt := First (Alternatives (N)); while Present (Alt) loop - Res := - Make_Or_Else (Sloc (Alt), - Left_Opnd => Res, - Right_Opnd => Make_Cond (Alt)); + Evolve_Or_Else (Res, Make_Cond (Alt)); Next (Alt); end loop;
reply other threads:[~2023-05-26 7:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230526073725.5CEF5384D19F@sourceware.org \ --to=dkm@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).