From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3A7673851C3E; Thu, 25 Feb 2021 18:29:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A7673851C3E From: "matz at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99101] optimization bug with -ffinite-loops Date: Thu, 25 Feb 2021 18:29:12 +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: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: matz at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: Thu, 25 Feb 2021 18:29:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99101 --- Comment #18 from Michael Matz --- (In reply to Richard Biener from comment #11) > (In reply to Richard Biener from comment #10) > > Created attachment 50248 [details] > > dot of the CFG as CD-DCE sees it >=20 > (gdb) p debug_dominance_info (CDI_POST_DOMINATORS) > 2 3 > 3 11 > 4 6 > 5 9 > 6 7 > 7 1 > 9 11 > 11 4 > 12 3 So, on IRC you said that the at_eof is completely eliminated. I wonder why. It's true that bb6 post-dominates bb4, hence bb6 is not control dependend on bb4. But there are other blocks control dependend on bb4, namely bb5 and bb9. To see this observe that bb9 doesn't pdom bb4, but there's a path from bb4 = to bb9 (e.g. bb4 -> bb5 -> bb9), where one node in that path that isn't bb4 is pdom by bb9 (here bb5 and bb9 are such path nodes). With same reasoning al= so bb5 is control dependend on bb4 (the example path being bb4->bb5, and bb5 the only test=20 node to check for pdom by bb5). So, we have that bb5 and bb9 are control dependend on bb4, so removing of bb4 (or it's predicate) would be wrong. If our control dependence machinery doesn't figure out that cdep(bb4) =3D {bb5,bb9}, then that would be the bug. (I haven't checked what our cdep calculation gives as result here, the abov= e is what should have happened).=