From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AF8FC3858438; Tue, 18 Jan 2022 14:24:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF8FC3858438 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103388] [12 Regression] missed optimization for dead code elimination at -O3 (trunk vs 11.2.0) Date: Tue, 18 Jan 2022 14:24:42 +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: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: law at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status 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, 18 Jan 2022 14:24:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103388 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2021-11-23 00:00:00 |2022-1-18 Status|NEW |ASSIGNED --- Comment #4 from Richard Biener --- Re-confirmed.(In reply to Jeffrey A. Law from comment #3) > So to fix this right we'd need to duplicate some of the logic in > tree-ssa-threadupdate.c. Conceptually for block B where one or more > predecessors thread to target T, you make a single copy B', and redirect > *all* the relevant predecessors to B'. >=20 > In addition to allowing more aggressive threading, it would also reduce > codesize since currently we'll end up with multiple copies of B'. We have > optimizers that are supposed to clean that up, but I've never seen them d= o a > particularly good job. >=20 > This isn't likely to land in gcc-12. >=20 > An interim approach might be to go ahead and register the thread and only > reject it for size later if we're going to end up with multiple copies.=20 > After all this is a cost analysis question and we don't know until all the > paths are registered if it's profitable or not. So I think at least this should be possible, no? Also why do we need to do extra limitation? We should end up accounting for B's size N times without the optimization so the costing is still accurate, no? So IMHO the scaling factors do not make much sense to me, they were introdu= ced to fix PR68398. We need --param fsm-scale-path-stmts=3D1 to get the desired threading done.=