public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45178] New: CDDCE doesn't eliminate conditional code in infinite loop
@ 2010-08-04 9:46 rguenth at gcc dot gnu dot org
2010-08-04 13:05 ` [Bug tree-optimization/45178] " hubicka at ucw dot cz
2010-08-04 13:21 ` rguenth at gcc dot gnu dot org
0 siblings, 2 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-04 9:46 UTC (permalink / raw)
To: gcc-bugs
Reduced from gcc.dg/tree-ssa/ssa-dce-3.c:
int main(void)
{
unsigned j = 0;
while (1)
{
j += 500;
if (j % 7)
j++;
else
j--;
}
return 0;
}
--
Summary: CDDCE doesn't eliminate conditional code in infinite
loop
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
2010-08-04 9:46 [Bug tree-optimization/45178] New: CDDCE doesn't eliminate conditional code in infinite loop rguenth at gcc dot gnu dot org
@ 2010-08-04 13:05 ` hubicka at ucw dot cz
2010-08-04 13:21 ` rguenth at gcc dot gnu dot org
1 sibling, 0 replies; 8+ messages in thread
From: hubicka at ucw dot cz @ 2010-08-04 13:05 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
2010-08-04 9:46 [Bug tree-optimization/45178] New: CDDCE doesn't eliminate conditional code in infinite loop rguenth at gcc dot gnu dot org
2010-08-04 13:05 ` [Bug tree-optimization/45178] " hubicka at ucw dot cz
@ 2010-08-04 13:21 ` rguenth at gcc dot gnu dot org
1 sibling, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-04 13:21 UTC (permalink / raw)
To: gcc-bugs
------- 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|0000-00-00 00:00:00 |2010-08-04 13:21:34
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
[not found] <bug-45178-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2021-08-27 7:52 ` rguenth at gcc dot gnu.org
@ 2022-02-17 11:26 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-17 11:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:634c2bc38ff66f13164967a8e3b965e8255dd4d9
commit r11-9586-g634c2bc38ff66f13164967a8e3b965e8255dd4d9
Author: Richard Biener <rguenther@suse.de>
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 <rguenther@suse.de>
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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
[not found] <bug-45178-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-08-27 7:51 ` cvs-commit at gcc dot gnu.org
@ 2021-08-27 7:52 ` rguenth at gcc dot gnu.org
2022-02-17 11:26 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-27 7:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
[not found] <bug-45178-4@http.gcc.gnu.org/bugzilla/>
2021-08-26 12:02 ` rguenth at gcc dot gnu.org
2021-08-26 14:35 ` hubicka at ucw dot cz
@ 2021-08-27 7:51 ` cvs-commit at gcc dot gnu.org
2021-08-27 7:52 ` rguenth at gcc dot gnu.org
2022-02-17 11:26 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-27 7:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:41439e1f6d2da1e86538c726f0603cffd5dd098e
commit r12-3182-g41439e1f6d2da1e86538c726f0603cffd5dd098e
Author: Richard Biener <rguenther@suse.de>
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 <rguenther@suse.de>
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
[not found] <bug-45178-4@http.gcc.gnu.org/bugzilla/>
2021-08-26 12:02 ` rguenth at gcc dot gnu.org
@ 2021-08-26 14:35 ` hubicka at ucw dot cz
2021-08-27 7:51 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: hubicka at ucw dot cz @ 2021-08-26 14:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
--- Comment #4 from Jan Hubicka <hubicka at ucw dot cz> ---
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45178] CDDCE doesn't eliminate conditional code in infinite loop
[not found] <bug-45178-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-26 12:02 ` rguenth at gcc dot gnu.org
2021-08-26 14:35 ` hubicka at ucw dot cz
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-26 12:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|TREE |
Last reconfirmed|2021-07-26 00:00:00 |2021-8-26
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
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)
;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-02-17 11:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-04 9:46 [Bug tree-optimization/45178] New: CDDCE doesn't eliminate conditional code in infinite loop rguenth at gcc dot gnu dot org
2010-08-04 13:05 ` [Bug tree-optimization/45178] " hubicka at ucw dot cz
2010-08-04 13:21 ` rguenth at gcc dot gnu dot org
[not found] <bug-45178-4@http.gcc.gnu.org/bugzilla/>
2021-08-26 12:02 ` rguenth at gcc dot gnu.org
2021-08-26 14:35 ` hubicka at ucw dot cz
2021-08-27 7:51 ` cvs-commit at gcc dot gnu.org
2021-08-27 7:52 ` rguenth at gcc dot gnu.org
2022-02-17 11:26 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).