From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 9C3A93858C53; Fri, 9 Jun 2023 08:33:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C3A93858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 80D72AB6; Fri, 9 Jun 2023 01:34:31 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 117043F71E; Fri, 9 Jun 2023 01:33:44 -0700 (PDT) From: Richard Sandiford To: guojiufu Mail-Followup-To: guojiufu ,Richard Biener , gcc-patches@gcc.gnu.org, jeffreyalaw@gmail.com, segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com, richard.sandiford@arm.com Cc: Richard Biener , gcc-patches@gcc.gnu.org, jeffreyalaw@gmail.com, segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com Subject: Re: [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors References: <20230609052847.2128612-1-guojiufu@linux.ibm.com> <56dbba43adda001d1668c29e8024c85d@linux.ibm.com> Date: Fri, 09 Jun 2023 09:33:43 +0100 In-Reply-To: <56dbba43adda001d1668c29e8024c85d@linux.ibm.com> (guojiufu@linux.ibm.com's message of "Fri, 09 Jun 2023 16:24:43 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-21.9 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: guojiufu writes: > Hi, > > On 2023-06-09 16:00, Richard Biener wrote: >> On Fri, 9 Jun 2023, Jiufu Guo wrote: >> >>> Hi, >>> >>> As checking the code, there is a "gcc_assert (SCALAR_INT_MODE_P >>> (mode))" >>> in "try_const_anchors". >>> This assert seems correct because the function try_const_anchors cares >>> about integer values currently, and modes other than SCALAR_INT_MODE_P >>> are not needed to support. >>> >>> This patch makes sure SCALAR_INT_MODE_P when calling >>> try_const_anchors. >>> >>> This patch is raised when drafting below one. >>> https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603530.html. >>> With that patch, "{[%1:DI]=0;} stack_tie" with BLKmode runs into >>> try_const_anchors, and hits the assert/ice. >>> >>> Boostrap and regtest pass on ppc64{,le} and x86_64. >>> Is this ok for trunk? >> >> Iff the correct fix at all (how can a CONST_INT have BLKmode?) then >> I suggest to instead fix try_const_anchors to change >> >> /* CONST_INT is used for CC modes, but we should leave those alone. >> */ >> if (GET_MODE_CLASS (mode) == MODE_CC) >> return NULL_RTX; >> >> gcc_assert (SCALAR_INT_MODE_P (mode)); >> >> to >> >> /* CONST_INT is used for CC modes, leave any non-scalar-int mode >> alone. */ >> if (!SCALAR_INT_MODE_P (mode)) >> return NULL_RTX; >> > > This is also able to fix this issue. there is a "Punt on CC modes" > patch > to return NULL_RTX in try_const_anchors. > >> but as said I wonder how we arrive at a BLKmode CONST_INT and whether >> we should have fended this off earlier. Can you share more complete >> RTL of that stack_tie? > > > (insn 15 14 16 3 (parallel [ > (set (mem/c:BLK (reg/f:DI 1 1) [1 A8]) > (const_int 0 [0])) > ]) "/home/guojiufu/temp/gdb.c":13:3 922 {stack_tie} > (nil)) > > It is "set (mem/c:BLK (reg/f:DI 1 1) (const_int 0 [0])". I'm not convinced this is correct RTL. (unspec:BLK [(const_int 0)] ...) would be though. It's arguably more accurate too, since the effect on the stack locations is unspecified rather than predictable. Thanks, Richard