From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id EB1613858D39 for ; Sun, 2 Jul 2023 15:23:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB1613858D39 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 imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AF7011F88D; Sun, 2 Jul 2023 15:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688311438; 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=TioalXm4l2ciNVeEVyxBKIMoRLlMQBVdxkGv7tYNjys=; b=cTW+LXGBDjf9Kh/KQdChoFUrg9FirBgvPvnP0TbDdxzP43j3UMgJhfi2HDu+bqiShLHO7i xu9AxfpWmY4JreOh42bJYqskCBBBoYs3arN0J7b2nxfQX0bRbGJza6vEXbtEcewE4bAjym KdxXHgYdnMUF8sZ0o4DR/ax4f9+RUZM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688311438; 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=TioalXm4l2ciNVeEVyxBKIMoRLlMQBVdxkGv7tYNjys=; b=UB2LykArIBm4+GEsoe8J604Nvptty8oENH96/l9mvq6/UQtpWlLbWI6lw1hpX92Ha7irWu pE/nc4jbAdoyk7Cg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9DF261348D; Sun, 2 Jul 2023 15:23:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8QKHJo6WoWQLAwAAMHmgww (envelope-from ); Sun, 02 Jul 2023 15:23:58 +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] tree-ssa-math-opts: Fix up ICE in match_uaddc_usubc [PR110508] Date: Sun, 2 Jul 2023 17:23:48 +0200 Message-Id: References: Cc: gcc-patches@gcc.gnu.org In-Reply-To: To: Jakub Jelinek X-Mailer: iPhone Mail (20F75) X-Spam-Status: No, score=-5.4 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 02.07.2023 um 16:54 schrieb Jakub Jelinek via Gcc-patches : >=20 > =EF=BB=BFHi! >=20 > The match_uaddc_usubc matching doesn't require that the second > .{ADD,SUB}_OVERFLOW has REALPART_EXPR of its lhs used, only that there is > at most one. So, in the weird case where the REALPART_EXPR of it isn't > present, we shouldn't ICE trying to replace that REALPART_EXPR with > REALPART_EXPR of .U{ADD,SUB}C result. >=20 > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Ok Richard=20 > 2023-07-02 Jakub Jelinek >=20 > PR tree-optimization/110508 > * tree-ssa-math-opts.cc (match_uaddc_usubc): Only replace re2 with > REALPART_EXPR opf nlhs if re2 is non-NULL. >=20 > * gcc.dg/pr110508.c: New test. >=20 > --- gcc/tree-ssa-math-opts.cc.jj 2023-06-20 11:22:26.726887276 +0200 > +++ gcc/tree-ssa-math-opts.cc 2023-07-01 00:29:48.554230914 +0200 > @@ -4856,11 +4856,14 @@ match_uaddc_usubc (gimple_stmt_iterator > gsi_remove (&gsi2, true); > /* Replace the re2 statement with __real__ of the newly added > .UADDC/.USUBC call. */ > - gsi2 =3D gsi_for_stmt (re2); > - tree rlhs =3D gimple_assign_lhs (re2); > - g =3D gimple_build_assign (rlhs, REALPART_EXPR, > - build1 (REALPART_EXPR, TREE_TYPE (rlhs), nlhs)); > - gsi_replace (&gsi2, g, true); > + if (re2) > + { > + gsi2 =3D gsi_for_stmt (re2); > + tree rlhs =3D gimple_assign_lhs (re2); > + g =3D gimple_build_assign (rlhs, REALPART_EXPR, > + build1 (REALPART_EXPR, TREE_TYPE (rlhs), nlhs)); > + gsi_replace (&gsi2, g, true); > + } > if (rhs[2]) > { > /* If this is the arg1 + arg2 + (ovf1 + ovf2) or > --- gcc/testsuite/gcc.dg/pr110508.c.jj 2023-07-01 00:33:12.494405901 +0= 200 > +++ gcc/testsuite/gcc.dg/pr110508.c 2023-07-01 00:32:24.115075870 +0200= > @@ -0,0 +1,9 @@ > +/* PR tree-optimization/110508 */ > +/* { dg-do compile } */ > +/* { dg-options "-O2" } */ > + > +void > +foo (unsigned a, unsigned b, unsigned *c, _Bool d) > +{ > + __builtin_addc (a, b, d, c); > +} >=20 > Jakub >=20