http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48641
--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-12-23 21:47:08 UTC --- OK, the problem is that profile is wrong and jump threading gets into conflicting results and the results are propagated through the testcase because of specific CFG. I think all we can do is to add capping. I am testing Index: tree-ssa-threadupdate.c =================================================================== --- tree-ssa-threadupdate.c (revision 182657) +++ tree-ssa-threadupdate.c (working copy) @@ -513,7 +513,11 @@ redirect_edges (void **slot, void *data) e->src->index, e->dest->index, rd->dup_block->index); rd->dup_block->count += e->count; - rd->dup_block->frequency += EDGE_FREQUENCY (e); + + /* Excessive jump threading may make frequencies large enough so + the computation overflows. */ + if (rd->dup_block->frequency < BB_FREQ_MAX * 2) + rd->dup_block->frequency += EDGE_FREQUENCY (e); EDGE_SUCC (rd->dup_block, 0)->count += e->count; /* Redirect the incoming edge to the appropriate duplicate block. */