From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 3B2713858D28 for ; Fri, 22 Dec 2023 10:08:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B2713858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3B2713858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703239722; cv=none; b=oYDLIHTcjzjz2JmzVf1SQUJRYjs3YTTS5eMw7R0Ax3+U+nEN9KHC1NWMirBx9drDFhrNJr+WVJIiUFkP4lHC8eDAXruyAlAaqsTR4w1InlNy01mJYCcIZ774qJ81rvWIwfHKizokEisfSEPQRLZTmvwJqeErBiLx8JUmAZLNoho= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703239722; c=relaxed/simple; bh=pSIE/yoqSf5NuSbc53EzZ/OueBozHHah9MAZHO0rtnM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: Mime-Version:Subject:Date:Message-Id:To; b=l2SgAjK412AbhTbpI3V8tfndZKfrGwK1GYTvzUerxBtRTG6vQ6UyM+n/q6DSBk+X7zIZYXFNawHF1cKyZZF+dNIDY/n3AAwJsZCFQlD5kltQ+/OguuzB1ZbwWu1tJyjWBLEYrcsl3qWFXpa279nZMIEJWzT9S4IWqpsU1iIlarc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 12C6321E06; Fri, 22 Dec 2023 10:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703239720; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8ZNjsRIK7/Hht6C6H2CIxZUw5tmwyiCbXJoxU4Ie+s=; b=Vluy7DxDkYG2UmBFinga1ht7jLcnIjbZ6iujSkMzjX1K6oH7bCjEYdJafkjiPztEoo4RLj YlKDOV7JsFNzZ5sUfLkBzkaGUoqUSPlH8V88n99M9Zu/E5yUiSCr4plfy55P0ZN4OJhA/r Oo5ZwvcDbYqwDw1aRtKcYtx/veIDmNg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703239720; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8ZNjsRIK7/Hht6C6H2CIxZUw5tmwyiCbXJoxU4Ie+s=; b=1N9hCVX03fANru98tcRu+k9CQYSK3qOUylAxy+AnDJQ1im+cBkvjfrz1Din+yI5vKwnpj+ pfxRyLwPFz1vpWCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703239720; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8ZNjsRIK7/Hht6C6H2CIxZUw5tmwyiCbXJoxU4Ie+s=; b=Vluy7DxDkYG2UmBFinga1ht7jLcnIjbZ6iujSkMzjX1K6oH7bCjEYdJafkjiPztEoo4RLj YlKDOV7JsFNzZ5sUfLkBzkaGUoqUSPlH8V88n99M9Zu/E5yUiSCr4plfy55P0ZN4OJhA/r Oo5ZwvcDbYqwDw1aRtKcYtx/veIDmNg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703239720; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8ZNjsRIK7/Hht6C6H2CIxZUw5tmwyiCbXJoxU4Ie+s=; b=1N9hCVX03fANru98tcRu+k9CQYSK3qOUylAxy+AnDJQ1im+cBkvjfrz1Din+yI5vKwnpj+ pfxRyLwPFz1vpWCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E7B67136D6; Fri, 22 Dec 2023 10:08:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qGiOOCdghWVIcwAAD6G6ig (envelope-from ); Fri, 22 Dec 2023 10:08:39 +0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] lower-bitint: Handle unreleased SSA_NAMEs from earlier passes gracefully [PR113102] Date: Fri, 22 Dec 2023 11:08:29 +0100 Message-Id: References: Cc: gcc-patches@gcc.gnu.org In-Reply-To: To: Jakub Jelinek X-Mailer: iPhone Mail (21C66) X-Spam-Level: X-Spam-Level: X-Spamd-Result: default: False [-0.87 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-1.27)[89.78%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -0.87 X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: > Am 22.12.2023 um 09:17 schrieb Jakub Jelinek : >=20 > =EF=BB=BFHi! >=20 > On the following testcase earlier passes leave around an unreleased > SSA_NAME - non-GIMPLE_NOP SSA_NAME_DEF_STMT which isn't in any bb. > The following patch makes bitint lowering resistent against those, > the first hunk is where we'd for certain kinds of stmts try to ammend > them and the latter is where we'd otherwise try to remove them, > neither of which works. The other loops over all SSA_NAMEs either > already also check gimple_bb (SSA_NAME_DEF_STMT (s)) or it doesn't > matter that much if we process it or not (worst case it means e.g. > the pass wouldn't return early even when it otherwise could). >=20 > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Ok > 2023-12-22 Jakub Jelinek >=20 > PR tree-optimization/113102 > * gimple-lower-bitint.cc (gimple_lower_bitint): Handle unreleased > large/huge _BitInt SSA_NAMEs. >=20 > * gcc.dg/bitint-59.c: New test. >=20 > --- gcc/gimple-lower-bitint.cc.jj 2023-12-21 13:28:56.953120687 +0100 > +++ gcc/gimple-lower-bitint.cc 2023-12-21 14:08:00.199704511 +0100 > @@ -5827,7 +5827,7 @@ gimple_lower_bitint (void) > tree_code rhs_code; > /* Unoptimize certain constructs to simpler alternatives to > avoid having to lower all of them. */ > - if (is_gimple_assign (stmt)) > + if (is_gimple_assign (stmt) && gimple_bb (stmt)) > switch (rhs_code =3D gimple_assign_rhs_code (stmt)) > { > default: > @@ -6690,6 +6690,11 @@ gimple_lower_bitint (void) > release_ssa_name (s); > continue; > } > + if (gimple_bb (g) =3D=3D NULL) > + { > + release_ssa_name (s); > + continue; > + } > if (gimple_code (g) !=3D GIMPLE_ASM) > { > gimple_stmt_iterator gsi =3D gsi_for_stmt (g); > --- gcc/testsuite/gcc.dg/bitint-59.c.jj 2023-12-21 14:12:01.860350727 += 0100 > +++ gcc/testsuite/gcc.dg/bitint-59.c 2023-12-21 14:11:54.766449179 +010= 0 > @@ -0,0 +1,14 @@ > +/* PR tree-optimization/113102 */ > +/* { dg-do compile { target bitint } } */ > +/* { dg-options "-std=3Dc23 -O2" } */ > + > +unsigned x; > + > +#if __BITINT_MAXWIDTH__ >=3D 191 > +void > +foo (void) > +{ > + unsigned _BitInt(191) b =3D x; > + ~(b >> x) % 3; > +} > +#endif >=20 > Jakub >=20