From patchwork Fri Jan 7 16:27:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 49708 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AD3E43857C70 for ; Fri, 7 Jan 2022 16:41:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD3E43857C70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641573689; bh=oYKr/IqTStkZFTpC+MxyBDZ+4Mbft/Ws/q4WZw6YuHM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=GP20/k7tJNs5H0x5b32RIzRD9dyZQTJBbbNIsqX3+Fmy1u4PS3ncF/hwYEemadb4r oMfvI1f/w1R7IaeCoVaZRFrGjnvVjJJ1B988srpyZBv2fmaum9AU+xF3QEyfdUvlLd zGtKU2/942jQxtGrJPtSCNhQ4thDZ/wBIT8G8340= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 8E2593857C5E for ; Fri, 7 Jan 2022 16:27:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8E2593857C5E Received: by mail-wr1-x430.google.com with SMTP id r10so4383232wrc.3 for ; Fri, 07 Jan 2022 08:27:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=oYKr/IqTStkZFTpC+MxyBDZ+4Mbft/Ws/q4WZw6YuHM=; b=O7YhbMbt6UI2yuxFsGvLCN1tL2MItV0NDrq+azH8OPK//NmvcuScI9PYaCoyVrb8V5 8BS8MyIey8GFzpJB2yB4RVwKt37b2Izrbt74T5RaIkz4Otyc9nYik00Cj+psFSOmqLg0 SdFeUNenuzEGGe2hInOiUZb6DnMOCYuxIWIML3N1jKubrXgQP6eOaTECVoEnoM+AwN+4 LrysZ9sLHJEtkTRGfk1lRbtII39sxAdkrZQSSVRXOSLT1runhy8BW5tTCdzUVb+gQ+LA Fu9j5z6oW1SQkHdstlugCDvSq7iruwe+x5bf1LZqo0GCKWOLqbqne2PXTVpTtbp9PyE2 oLEw== X-Gm-Message-State: AOAM533YELd7lN8gi7wAg6lyIrBlUhdRe8QIt6BRq0PgBTcut1i5Axtq SQp4PCmCwyoejIqD9VwN09HbWLFCNbYDmg== X-Google-Smtp-Source: ABdhPJw4aF7+t94ksm5H77XpER/cc+n4+CmdoG14r9pwcOP5LeOStD+eNgQhInHJ6AEZYFSmfxfstg== X-Received: by 2002:a05:6000:188a:: with SMTP id a10mr54275939wri.423.1641572830598; Fri, 07 Jan 2022 08:27:10 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id 5sm5373012wrb.77.2022.01.07.08.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 08:27:09 -0800 (PST) Date: Fri, 7 Jan 2022 16:27:09 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Remove explicit expansion of block with general case statement Message-ID: <20220107162709.GA948459@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.1 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" When a general case statements is rewritten into a block, it is enough to call Analyze on this block node, because analysis of non-expressions automatically triggers expansion. Cleanup originating from investigating many variants of routines for (pre)analysis and resolution. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch5.adb (Expand_N_Case_Statement): Remove explicit expansion. diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -39,7 +39,6 @@ with Exp_Dbug; use Exp_Dbug; with Exp_Pakd; use Exp_Pakd; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; -with Expander; use Expander; with Inline; use Inline; with Namet; use Namet; with Nlists; use Nlists; @@ -3876,7 +3875,6 @@ package body Exp_Ch5 is if Extensions_Allowed and then not Is_Discrete_Type (Etype (Expr)) then Rewrite (N, Expand_General_Case_Statement); Analyze (N); - Expand (N); return; end if;