------- Comment #8 from rguenth at gcc dot gnu dot org 2010-02-13 10:11 ------- (In reply to comment #3) > Basically yet another example of why it is a REALLY BAD IDEA to use constants > as PHI arguments. If the constant from "s =0" would not be propagated into the > PHI, the statement would not be dead and removed, and no new "s=0" would have > to be inserted in the wrong place. > > See bug 42906 for another example of exactly the same problem. > > Allowing constants as PHI arguments is GCC's biggest design f*ck-up.
I'm not sure - do other compilers usually not allow this? It shouldn't be hard to at least disable propagation of constants into PHIs (there may be a number of optimizers generating PHIs with constants initially though). Note that I also see <bb 4>: # s_1 = PHI <s_6(3)> again and again - shouldn't these be plain assignments as well? Thus, should blocks with a single predecessor have PHIs at all? I suppose with the insertion at the wrong place you mean <bb 3>: # i_2 = PHI <0(2)> # s_11 = PHI <0(2)> as done by the pre-header generated by loop init? (they are dead anyway, but re-generated all the time) -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42839