From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1AD1E3858C27; Thu, 14 Sep 2023 21:22:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1AD1E3858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694726546; bh=d1PuQgP8m4dV5+BlYPwFSawL9T2UhUz81cl6tmHXs4s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Mh2zlZ843JQxwHAeksXuEtib7NhbcxWUBZiodMr05JlCzlhdIOsr4RTvPuhhtsrxl eVB8DRWikIxQqanOZRRkDDMBM+laFliVNlgHyIbtXJ0/P0JVKkmULQ4li0iDHMbCOT /VBkfmI3+DEXZUWv0P5pWl9kmNqFCvKq+xgwSyIY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110992] [14 Regression] Dead Code Elimination Regression at -O3 since r14-1654-g7ceed7e3e29 Date: Thu, 14 Sep 2023 21:22:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110992 --- Comment #4 from Andrew Pinski --- What we had before in GCC 13: # RANGE [irange] unsigned short [0, 1] NONZERO 0x1 d.3_19 =3D (unsigned short) _3; _21 =3D -d.3_19; _22 =3D (short intD.17) _21; _6 =3D (short intD.17) b.0_1; _7 =3D _6 & _22; Which then after r14-1654-g7ceed7e3e29 gives us: _t =3D (short intD.17) d.3_19 _7 =3D _6 * _t What we get after that match patch: _3 =3D c.1_2 !=3D 0; _25 =3D (short intD.17) _3; _22 =3D -_25; _6 =3D (short intD.17) b.0_1; _7 =3D _6 & _22; That is we lose the range information. If I add this to match.pd: ``` diff --git a/gcc/match.pd b/gcc/match.pd index 97db0eb5f25..e68e2c57e25 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2181,6 +2181,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && (TYPE_UNSIGNED (type) || TYPE_PRECISION (type) > 1)))) +(match zero_one_valued_p + (convert@0 zero_one_valued_p@1)) + /* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }. */ (simplify (mult zero_one_valued_p@0 zero_one_valued_p@1) ``` Then this fails again. I am thinking about adding this anyways so I am going to keep this one open= .=