This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42906] [4.5 Regression] Empty loop not removed
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2010 16:51:15 -0000
- Subject: [Bug tree-optimization/42906] [4.5 Regression] Empty loop not removed
- References: <bug-42906-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from steven at gcc dot gnu dot org 2010-01-30 16:51 -------
Eh, ignore comment #3. My understanding of CD-DCE really *is* rusty :-).
Being more careful now: IIRC the statement "j = 0" would have been control
dependent on "if (b)" and marking "j = 0" would result in marking "if (b)"
necessary.
But since the value "0" is propagated into the PHI, there is no statement left
to mark "if (b)" necessary. So ignoring the edge with the constant (like the
very wrong patch of comment #3) results in *nothing* needing "if (b)" anymore.
So the function is incorrectly transformed to just "return j".
What is necessary here, is a reason to mark "if (b)" necessary, but not the
loop. But since the loop now falls through directly to the PHI for "j_1", I
don't see how...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42906