[Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178 --- Comment #7 from CVS Commits --- The releases/gcc-11 branch has been updated by Richard Biener : https://gcc.gnu.org/g:634c2bc38ff66f13164967a8e3b965e8255dd4d9 commit r11-9586-g634c2bc38ff66f13164967a8e3b965e8255dd4d9 Author: Richard Biener Date: Fri Aug 27 09:47:49 2021 +0200 tree-optimization/45178 - DCE of dead control flow in infinite loop This fixes DCE to be able to elide dead control flow in an infinite loop without an exit edge. This special situation is handled well by the code finding an edge to preserve since there's no chance it will find the exit edge and make the loop finite. 2021-08-27 Richard Biener PR tree-optimization/45178 * tree-ssa-dce.c (find_obviously_necessary_stmts): For infinite loops without exit do not mark control dependent edges of the latch necessary. * gcc.dg/tree-ssa/ssa-dce-3.c: Adjust testcase. (cherry picked from commit 41439e1f6d2da1e86538c726f0603cffd5dd098e)
[Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178 Richard Biener changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #6 from Richard Biener --- Fixed.
[Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178 --- Comment #5 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:41439e1f6d2da1e86538c726f0603cffd5dd098e commit r12-3182-g41439e1f6d2da1e86538c726f0603cffd5dd098e Author: Richard Biener Date: Fri Aug 27 09:47:49 2021 +0200 tree-optimization/45178 - DCE of dead control flow in infinite loop This fixes DCE to be able to elide dead control flow in an infinite loop without an exit edge. This special situation is handled well by the code finding an edge to preserve since there's no chance it will find the exit edge and make the loop finite. 2021-08-27 Richard Biener PR tree-optimization/45178 * tree-ssa-dce.c (find_obviously_necessary_stmts): For infinite loops without exit do not mark control dependent edges of the latch necessary. * gcc.dg/tree-ssa/ssa-dce-3.c: Adjust testcase.
[Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178 --- Comment #4 from Jan Hubicka --- > and that marks a condition that has nothing to do with loop control. I > suppose > we can elide this when the loop has no exit (we are already marking backedges > of irreducible loops). > > But I never actually understood this particular part of CD-DCE. Skipping this for loops with no exit edges should work - we will end up removing some control flow inside but the logic finding path to next live stmt can probably be told to chose any path in empty fully infinite loop. Honza
[Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178 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 suppose we can elide this when the loop has no exit (we are already marking backedges 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) ; }
[Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
--- Comment #1 from hubicka at ucw dot cz 2010-08-04 13:05 --- Subject: Re: New: CDDCE doesn't eliminate conditional code in infinite loop Hmm, so the problem is that we produce two alternating loops and both with unknown number of iterations? We might teach loop discovery to preffer single infinite loop over alternation I guess. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
[Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
--- Comment #2 from rguenth at gcc dot gnu dot org 2010-08-04 13:21 --- (In reply to comment #1) Subject: Re: New: CDDCE doesn't eliminate conditional code in infinite loop Hmm, so the problem is that we produce two alternating loops and both with unknown number of iterations? We might teach loop discovery to preffer single infinite loop over alternation I guess. Yeah, that might help. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-08-04 13:21:34 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178