From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A4FC23858401; Tue, 15 Feb 2022 23:14:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4FC23858401 From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104530] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs. 11.2.0) Date: Tue, 15 Feb 2022 23:14:44 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Feb 2022 23:14:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104530 --- Comment #2 from Andrew Macleod --- mmm. tricky.=20=20 Imports: b.0_1 d.3_7 Exports: b.0_1 _2 _3 d.3_7 _8 _2 : b.0_1(I) _3 : b.0_1(I) _2 _8 : b.0_1(I) _2 _3 d.3_7(I) : b.0_1 =3D b; _2 =3D b.0_1 =3D=3D 0B; _3 =3D (int) _2; c =3D _3; _5 =3D *b.0_1; <<-- from this point b.0_1 is [+1, +INF] a =3D _5; d.3_7 =3D d; _8 =3D _3 % d.3_7; if (_8 !=3D 0) goto ; [INV] else goto ; [INV] This is a bit at conflict with the "lets be safe" approach without pre-scan= ning the block for lack of throwing stmts. Although that's really just a half measure since you can construct more complicated blocks with a mix. Im experimenting with marking values as stale for all exports of the block which are dependant on the value we set to non null. ie, _2, _3 and _8=20 Then when we ask for a range of that name AFTER the de-reference, it will recompute it. The use of _3 in computing _8 is then "stale", and will be re-evaluated. Simple in concept, but I'm encountering an interaction with how we currently set the global values for the end of the pass, and although I can recompute= _2 fine, it is also setting the global value of _2 to [0,0], which is not what= we want. Works for this case, but returns us to the same situation we had bef= ore if there is a call in the block. Im continuing to look at it. Easy fix in the next release since we are goi= ng to change the way we export globals outside the pass... but we shall see ab= out this release whether I can keep it contained.=