From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A70D3382EA07; Fri, 30 Jun 2023 22:29:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A70D3382EA07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688164187; bh=GV4K5gcn7bhCNxLCeJuwcsyD/L5UAzZ9QVywseP/0Qs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LW/YO5VK9K699t73pYYU3ePzPFc302ELOqeay783jD6W3onPIl6tMHnjpc0YIpg7D ShLbLDuE6nSe7HEXcqo3l5PiQOkSpt4vVYw8EDd5DJVBUh3nPbAincYeiOlfRXEZW5 y0QbuTJxHg8u/26mPQdL5jP2z+sB4E0t6ChB/e+0= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110503] [13/14 Regression] Dead Code Elimination Regression at -O3 since r13-322-g7f04b0d786e Date: Fri, 30 Jun 2023 22:29:47 +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: 13.2 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=3D110503 --- Comment #3 from Andrew Pinski --- (In reply to Andrew Pinski from comment #2) >=20 > Oh and had: > # RANGE [irange] int [-128, 127] > _10 =3D (intD.6) _9; > # RANGE [irange] int [0, 1] NONZERO 0x1 > _11 =3D 1 % _10; >=20 > I wonder if we could optimize `1 % b` into just `b !=3D 1` (since 1 % 0 is > undefined) which will further reduce things here. That does not change the size of the loop though and we are still left with: size: 1 _10 =3D _9 =3D=3D 1; size: 0 _11 =3D (unsigned int) _10; size: 1 _12 =3D -_11; size: 2 if (_12 > 2) But at least now we just need to optimize the above to just `if (_9 =3D=3D = 1)` Something like: (simplify (gt (negative zero_one_value@0) INTEGER_CST@1) (if (wi::to_wide (@1) >=3D 1 && TYPE_UNSIGNED (TREE_TYPE (@1))) (ne @0 { build_zero_cst (TREE_TYPE (@1)); } ) (if (wi::to_wide (@1) >=3D 0 && !TYPE_UNSIGNED (TREE_TYPE (@1))) (eq @0 { build_zero_cst (TREE_TYPE (@1)); } ) ) ) ) But I get the feeling this should be done in VRP instead of match ...=