http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55629
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-10 08:50:12 UTC --- I know that there is a duplicate of this bug, at least for a simpler testcase ... but I can't find it right now. The issue is that SCCVN does not do PHI-translation, that is, <bb 2>: if (c_3(D) != 0) goto <bb 3>; else goto <bb 4>; <bb 3>: a_4 = 3; b_5 = 2; goto <bb 5>; <bb 4>: a_6 = 2; b_7 = 3; <bb 5>: # a_1 = PHI <3(3), 2(4)> # b_2 = PHI <2(3), 3(4)> _8 = a_1 + b_2; SCCVN would need to lookup a_1 and b_2 on both incoming edges when it tries to simplify a_1 + b_2, match up the results and if equal register the simplification. I'm not sure that handling this case (which would certainly be possible) is worth the cost it has on all expressions that do _not_ simplify that way. (of course we can see whether the value-numbers for a_1/b_2 do have has_constants set). Time for a value-number missed-optimization meta bug, there are quite some special cases that we do not handle.