From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 92BB53858436; Wed, 21 Dec 2022 13:48:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92BB53858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671630521; bh=SGg5PASLCTt/kOBQ8yPEo41d9M+/Pvwb9vvrwjX8F9A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BDhKKOEEXhFoWJuqJE0yNxDTGIf26INWwItTnbX3guKXvKwUJulA9iu0/ZdlKDlwK K3veC5NtFw65Q2L2rD7bFVjsCAc+40JzOnZYj9uPdCi2mwyw1wjGWY7ltwXkC7yQPb mLREAfhPDm5gn6VVEBfwOhaj6u0gY1ocJG6j3gNE= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107822] [13 Regression] Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) Date: Wed, 21 Dec 2022 13:48:41 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cc cf_known_to_fail cf_known_to_work everconfirmed priority cf_reconfirmed_on 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=3D107822 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |aldyh at gcc dot gnu.org Known to fail| |13.0 Known to work| |12.2.1 Ever confirmed|0 |1 Priority|P3 |P1 Last reconfirmed| |2022-12-21 --- Comment #1 from Richard Biener --- Confirmed. Same with -O2. Visiting conditional with predicate: if (c_13 !=3D 0) With known ranges=20 c_13: [irange] int [-INF, +INF] NONZERO 0x3 Predicate evaluates to: DON'T KNOW Not folded vs. handling the cycle PHI for c: [local count: 118111600]: b =3D 0; goto ; [100.00%] [local count: 955630225]: _1 =3D c_10 ^ 3; _2 =3D b.1_3 + 1; b =3D _2; [local count: 1073741824]: # c_10 =3D PHI <1(2), _1(3)> b.1_3 =3D b; if (b.1_3 <=3D 8) goto ; [89.00%] else goto ; [11.00%] [local count: 118111600]: # c_13 =3D PHI if (c_13 !=3D 0) Value ranges after VRP: _1: int [1, 2] c_2: int [1, 2] this is yet another case where proper propagation is important. I'm questioning the idea that on-demand ranger is a good solution and replacing VRP1 was premature? I'm asking again as to what the plan was for cases like this? bit-CCP propagation arrives with Simulating statement: c_10 =3D PHI <1(2), _1(3)> Visiting PHI node: c_10 =3D PHI <1(2), _1(3)> Argument #0 (2 -> 4 executable) 1 Value: CONSTANT 1 Argument #1 (3 -> 4 executable) _1 Value: CONSTANT 0x0 (0x3) PHI node value: CONSTANT 0x0 (0x3) but it doesn't know that always either bit zero or one is set.=