http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48600
--- Comment #15 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-01-31 14:31:56 UTC --- I am testing the attached patch Index: predict.c =================================================================== --- predict.c (revision 183666) +++ predict.c (working copy) @@ -1833,6 +1833,10 @@ predict_paths_for_bb (basic_block cur, b edge_iterator ei; basic_block son; + /* AUX is used to detect cycles while walking predictors with only EH/FAKE + succestors. */ + cur->aux = (void *)(size_t) 1; + /* We are looking for all edges forming edge cut induced by set of all blocks postdominated by BB. */ FOR_EACH_EDGE (e, ei, cur->preds) @@ -1848,7 +1852,7 @@ predict_paths_for_bb (basic_block cur, b continue; gcc_assert (bb == cur || dominated_by_p (CDI_POST_DOMINATORS, cur, bb)); - /* See if there is how many edge from e->src that is not abnormal + /* See if there is an edge from e->src that is not abnormal and does not lead to BB. */ FOR_EACH_EDGE (e2, ei2, e->src->succs) if (e2 != e @@ -1864,13 +1868,14 @@ predict_paths_for_bb (basic_block cur, b leading to e->src. */ if (found) predict_edge_def (e, pred, taken); - else + else if (!e->src->aux) predict_paths_for_bb (e->src, e->src, pred, taken); } for (son = first_dom_son (CDI_POST_DOMINATORS, cur); son; son = next_dom_son (CDI_POST_DOMINATORS, son)) predict_paths_for_bb (son, bb, pred, taken); + cur->aux = (void *)(size_t) NULL; } /* Sets branch probabilities according to PREDiction and