From patchwork Thu Oct 6 09:26:43 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: 1760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp218019wrs; Thu, 6 Oct 2022 02:27:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6u635Mkhi2GagrlUkYw7kwTiazBjKMfXkb/TWNV6/N8uCGOVMeX0iH9mPALhjnIB7JaQEf X-Received: by 2002:a17:907:845:b0:731:2f6c:6dbd with SMTP id ww5-20020a170907084500b007312f6c6dbdmr3155140ejb.551.1665048475844; Thu, 06 Oct 2022 02:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665048475; cv=none; d=google.com; s=arc-20160816; b=z+DJm3wPP5CCX5ba/k8R6eOn3wZfUP6GaMDZaTgLIUcj/MEqLs+bOiEEARJvw5BmWs MBAISWi3nsf7zRuOcgb6yjhyF3KuHKsqXa7VOL49NfVbmlxU4VTwZE4lOXJgLsyEjNPx fESkjwUbPE37RKLtnrjbW0PdmfxB3ulkwVyCEK403oVYHkds6prS8dkeBSP1IfebwKML W9hDEnyMUpKiyR2WIgeiiAORMoCJLa9H+vwH2EnqRior6wU5Ayubr8Q6W2ExuSYtRsOx P6sNLOE9O0DCHfxhugPqvF5/kvvdnWmvh4+QED837++BA+HKSNAUWanwF+bcQGUyERPk nJwA== 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=7vb3M2hW9Zf/03QihnmzzjLTZKc1aNkfpDF42p8Hy5s=; b=UEBsOgMXbprHu4Ny2vJsoxohC6zVsx2QE5XeEY5hr1X3QQ3BdYslkYftCptRgpoyAk V6994e9DMyZFIGzYk7echZtSacmU4wf9A3yWBQgfHGv1STQVcT9uyBelAQWLI0ZJyeA7 pV/Gm3W0uZgU+wWVtXEoCRpVwP04hrRJ5vDJ83VWnBWwLv3NzGNViBhmC4g9nI1Hjrv7 wAhGgjcyHDkZtVh6uiH6j2xTj7atP/aQY/3wsQ9ZxfG0xl3pnxvyfGX9rp6uPRtbq7ib r5opKju9AnSb2/Nkwl7NVQSnZ7F0k1p4s3RsVSNnEEoG3bzzJ0inX3gqxHzsV7YjZA3J hdzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fb0Wmx4q; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u9-20020a50d509000000b00451755bcdbfsi15213557edi.305.2022.10.06.02.27.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 02:27:55 -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=fb0Wmx4q; 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 5FF5C384B0CB for ; Thu, 6 Oct 2022 09:27:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FF5C384B0CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665048474; bh=7vb3M2hW9Zf/03QihnmzzjLTZKc1aNkfpDF42p8Hy5s=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=fb0Wmx4qtjB0iSQKT31UrIvbJUjsU2xanxUR4hEGuDiWmaIITuowcCfTEJoRWutrR OWIjzK6j+oJ/erZc5k31oPQvlg+NVIOV5xx5S2g+TRo6zOLO6fVa96SD246LRF+ndA yf+qn8P93y+xkJnIytTkuCm0K+tr9Hn5lbQyLQDI= 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 3D48B384BC3A for ; Thu, 6 Oct 2022 09:27:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D48B384BC3A Received: by mail-wm1-x333.google.com with SMTP id o20-20020a05600c4fd400b003b4a516c479so565062wmq.1 for ; Thu, 06 Oct 2022 02:27:01 -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=7vb3M2hW9Zf/03QihnmzzjLTZKc1aNkfpDF42p8Hy5s=; b=Jgum/NhqNuBOnvaHn9hkCCqizMmfeXuLs5ruSSqrHWw9SdzmlP7ks3bCWtFFluIhhw OUNA+bXttsiShHH65CRWF8Tgp+2K0/6cbuv0U8az+lx3wITywdUfTIXu7x9cEb4y7s6r 5zL3FYSn/ulwHzr4MFALc69CxpoQ/54+GzRq0vbUbFCLt/Fv/REsmf/nj2+ThcBLMXLH 5flzeeZ/J5x3ieg8yI9nVfKp1kdJ+YAp0DP8V9gd4HWvShRDTtxqPT8A/gCOxHJdPW6C GzaVDLMeTIyhxUtMHbpAQ2whHUcPBUMicLLh/KadwYGwsHWxhuGStVjJdMLNfG2Os/8/ WsTw== X-Gm-Message-State: ACrzQf1nHjD4aM8D10SUgkPBUKGuL8wNQNps9DMi2iFBKpRB1RGGPZ1p fHRxCiYhH55T3kLiAwQw/EfZ/Zea/jW1GB7M X-Received: by 2002:a05:600c:d5:b0:3c0:fba1:d2b9 with SMTP id u21-20020a05600c00d500b003c0fba1d2b9mr2273608wmm.108.1665048419759; Thu, 06 Oct 2022 02:26:59 -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 j8-20020a05600c190800b003bfaba19a8fsm4468440wmq.35.2022.10.06.02.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 02:26:59 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [COMMITED] ada: Disable slice-of-component optimization in some cases Date: Thu, 6 Oct 2022 11:26:43 +0200 Message-Id: <20221006092643.260420-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 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: Bob Duff 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?1745929870694556615?= X-GMAIL-MSGID: =?utf-8?q?1745929870694556615?= From: Bob Duff This patch disables the Fast_Copy_Bitfield optimization in certain rare cases that currently do not work (crash in gigi). We could improve Expand_Assign_Array_Bitfield_Fast to handle these cases properly, but that change is delicate, so for now, we simply disable the optimization. gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Disable the Fast_Copy_Bitfield optimization in certain cases. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch5.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 209741c82cf..9669737a79b 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -1660,6 +1660,15 @@ package body Exp_Ch5 is return False; end Volatile_Or_Independent; + function Slice_Of_Packed_Component (L : Node_Id) return Boolean is + (Nkind (L) = N_Slice + and then Nkind (Prefix (L)) = N_Indexed_Component + and then Is_Bit_Packed_Array (Etype (Prefix (Prefix (L))))); + -- L is the left-hand side Name. Returns True if L is a slice of a + -- component of a bit-packed array. The optimization is disabled in + -- that case, because Expand_Assign_Array_Bitfield_Fast cannot + -- currently handle that case correctly. + L : constant Node_Id := Name (N); R : constant Node_Id := Expression (N); -- Left- and right-hand sides of the assignment statement @@ -1681,6 +1690,7 @@ package body Exp_Ch5 is 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) and then not Volatile_Or_Independent (R, R_Type) then