[Bug tree-optimization/42906] [4.5 Regression] Empty loop not removed

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Jan 30 16:55:00 GMT 2010



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-01-30 16:54 -------
(In reply to comment #4)
> 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...

You have the other PHI argument for that which _is_ control-dependent on
if (b) (like the constant PHI arg should be).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42906



More information about the Gcc-bugs mailing list