From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 453973858402; Thu, 26 Aug 2021 12:02:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 453973858402 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop Date: Thu, 26 Aug 2021 12:02:05 +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: 4.6.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords 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 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, 26 Aug 2021 12:02:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D45178 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|TREE | Last reconfirmed|2021-07-26 00:00:00 |2021-8-26 --- Comment #3 from Richard Biener --- So no, that's not the problem at all. The only loop is the infinite while = (1) one, the problem is that because we cannot prove finiteness of the loop we'= re doing for (auto loop : loops_list (cfun, 0)) if (!finite_loop_p (loop)) { if (dump_file) fprintf (dump_file, "cannot prove finiteness of loop %i\n", loop->num); mark_control_dependent_edges_necessary (loop->latch, false); } and that marks a condition that has nothing to do with loop control. I sup= pose we can elide this when the loop has no exit (we are already marking backedg= es of irreducible loops). But I never actually understood this particular part of CD-DCE. The desired transform is that we end up with just int main() { while (1) ; }=