From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id CCA58384D170 for ; Thu, 6 Oct 2022 09:28:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCA58384D170 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-x32d.google.com with SMTP id bg9-20020a05600c3c8900b003bf249616b0so557391wmb.3 for ; Thu, 06 Oct 2022 02:28:23 -0700 (PDT) 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=iCHnHkc+nfjuRTgjj9DLDz7tueKJxSjomH8d8l1ShsM=; b=YXzM5D/BfC768INYRFu4EKCWCN1jmMfIqsvAlfcMGHejmwjva1pBUVzgTQCH5sZ/C/ b+wP6w3J2pPwG+Y+EycUXw5l7AmpBCc/HIFnWw4DuYGYmrNa7/ZU1MXJuYYXzhq94DgA gkECMPHQoxO+byHdaRTi2nidQBK2NpXzkWC+IzB+/f9cZ4eiIQTIvj3095gTaigIes1j qqhzcbZhi9n/HltJsP+gmH62gbWBM4+0KD7vRkGh6ctOfS0Hmnyqaox9PGAP9VnLOaj4 tEzlszXVun6bJ75KPbGBZOzfj8aqPJi8AGClN7EXm0DA+efnqpdvX4T6HwcqS0GMUrTP Gbmw== 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=iCHnHkc+nfjuRTgjj9DLDz7tueKJxSjomH8d8l1ShsM=; b=viHPPZPqjNSOoBEcfzbFOC79omclJKh0QeZe20c+3gmDuBra6uZhWm/s1IMZ7Gqm6y 5ZVpckconB2z49vMaSpiaqPRQL6Qe51rWQdePcT/LxKGXrvxC2bMSfq7+RKCO/SrGN0L /JsXiOTzdWZCEipsLwJE1qFR4/LpPjjMBR7kT2AezloIOgTWwbZEZrfDlxDrRgCYoQuj Rfm37p4UycG8WhY41161ygilzG1r1Agie1L5MV+S+zaTuDnH4nxajgbVuMTv0VinzG1B 2A2uFz4EmUo8glZieOB5oegVx50e+Dy5bwk4PAzdCOayMrR0+XLPlFro04mPfUMsZbGh Lj1g== X-Gm-Message-State: ACrzQf3ID6TLlrURn1uQm0gJ9o5vMFd/Zrf0jHe5fjwVujLyxLoCy5L+ P+l0SdtAsNMJPELoJC3yJCOAM48hy2IAXnxi X-Google-Smtp-Source: AMsMyM6pcvFP3b9LXPixc7xuXwbJ6JTCF8L+nQBf+lkO36y/TdY3lxKLETKB5RvnQKTRzpspS+is2w== X-Received: by 2002:a05:600c:1e16:b0:3c2:192e:27fb with SMTP id ay22-20020a05600c1e1600b003c2192e27fbmr679911wmb.122.1665048502636; Thu, 06 Oct 2022 02:28:22 -0700 (PDT) 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 24-20020a05600c025800b003c1a7ea3736sm1266683wmj.11.2022.10.06.02.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 02:28:22 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [COMMITED] ada: Clean up slice-of-component optimization Date: Thu, 6 Oct 2022 11:28:10 +0200 Message-Id: <20221006092810.260715-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.2 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: Bob Duff In the recursive case of Volatile_Or_Independent = False for array types, fall through into later checks, so for example we check the type of the prefix of a slice. The pattern here is "return True in certain cases, otherwise fall through into the final 'return False'". Remove check for "Ndim = 1"; if Slices is True, then the number of dimensions is necessarily 1, because Ada doesn't have multi-dimensional slices. gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Minor cleanups. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch5.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 9669737a79b..d5d66d961de 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -1632,7 +1632,10 @@ package body Exp_Ch5 is end if; if Is_Array_Type (Typ) then - return Volatile_Or_Independent (Empty, Component_Type (Typ)); + if Volatile_Or_Independent (Empty, Component_Type (Typ)) then + return True; + end if; + elsif Is_Record_Type (Typ) then declare Comp : Entity_Id := First_Component (Typ); @@ -1688,7 +1691,6 @@ package body Exp_Ch5 is and then Is_Bit_Packed_Array (R_Type) and then not Reverse_Storage_Order (L_Type) and then not Reverse_Storage_Order (R_Type) - and then Ndim = 1 and then Slices and then not Slice_Of_Packed_Component (L) and then not Volatile_Or_Independent (L, L_Type) -- 2.34.1