------- Comment #6 from rguenth at gcc dot gnu dot org 2010-01-30 10:59 ------- The interesting thing is that the empty loop is not removed by the control-dependent DCE pass that follows the 2nd VRP.
This happens because <bb 3>: if (obj_7(D) != 0B) goto <bb 5>; else goto <bb 4>; <bb 4>: # i_36 = PHI <0(3)> <bb 10>: # i_25 = PHI <i_36(4), i_35(12)> i_35 = i_25 + 1; if (i_35 != num_6(D)) goto <bb 12>; else goto <bb 8>; <bb 12>: goto <bb 10>; ... <bb 7>: Invalid sum of incoming frequencies 6888, should be 7735 # s_2 = PHI <s_19(6), s_23(11)> i_20 = i_18 + 1; if (i_20 != num_6(D)) goto <bb 13>; else goto <bb 8>; ... <bb 8>: # s_3 = PHI <s_2(7), 0(10)> the PHI node defining s_3 marks the controlling statement necessary which in turn marks the loop necessary. Now the question is if this is an inherent limitation of CD-DCE or if the controlling stmt should be that in BB3 instead (the immediate common dominator of bb7 and bb10 is bb3). Steven? You implemented that CD-DCE stuff? -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu dot | |org, hubicka at gcc dot gnu | |dot org Keywords| |missed-optimization http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42720