From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id B043F3858C41; Fri, 9 Jun 2023 08:00:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B043F3858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E7E181FDF2; Fri, 9 Jun 2023 08:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686297640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AwBW6x49v0aKMbB0k5pFzzMsfB5rWym7mjAOQ1ntXnc=; b=Y7cAw3+Flhd5pWNWyopuqKElAVX0O6rwph8+Tkk4A5rt3OpT/MF+bDyqrAItZ8PWzB0fXy TLe9iWggwBrTHXIpOyABiqE3nWdC+O1cvOvsmsOEiJfeoTlkcVJN0lMICJs4HGNZLS8xQ4 mH5Ul19VdW0G5rUNCa7UHixx3XWXiXQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686297640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AwBW6x49v0aKMbB0k5pFzzMsfB5rWym7mjAOQ1ntXnc=; b=nmxQ39aDFgz9gltykvwaIPd5LFVCMRkMl7GtkUwypGhcFhMawK3vAwFHTaARg8MdFtuqnV jMW4qAPQBWZGzKDA== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8FC2A2C142; Fri, 9 Jun 2023 08:00:40 +0000 (UTC) Date: Fri, 9 Jun 2023 08:00:40 +0000 (UTC) From: Richard Biener To: Jiufu Guo cc: gcc-patches@gcc.gnu.org, jeffreyalaw@gmail.com, richard.sandiford@arm.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 In-Reply-To: <20230609052847.2128612-1-guojiufu@linux.ibm.com> Message-ID: References: <20230609052847.2128612-1-guojiufu@linux.ibm.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: 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; 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? > > BR, > Jeff (Jiufu Guo) > > gcc/ChangeLog: > > * cse.cc (cse_insn): Add SCALAR_INT_MODE_P condition. > > --- > gcc/cse.cc | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/cse.cc b/gcc/cse.cc > index 2bb63ac4105..f213fa0faf7 100644 > *** a/gcc/cse.cc > --- b/gcc/cse.cc > *************** > *** 5003,5009 **** > if (targetm.const_anchor > && !src_related > && src_const > ! && GET_CODE (src_const) == CONST_INT) > { > src_related = try_const_anchors (src_const, mode); > src_related_is_const_anchor = src_related != NULL_RTX; > - - > --- 5003,5010 ---- > if (targetm.const_anchor > && !src_related > && src_const > ! && GET_CODE (src_const) == CONST_INT > ! && SCALAR_INT_MODE_P (mode)) > { > src_related = try_const_anchors (src_const, mode); > src_related_is_const_anchor = src_related != NULL_RTX; > 2.39.3 > > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)