http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45352
--- Comment #25 from Andrey Belevantsev <abel at gcc dot gnu.org> 2010-12-24 08:23:07 UTC --- Zdenek, please don't worry about the set of flags, it does not make fixing the problem any harder, and your work on finding these is invaluable for us. Sigh, in this case I forgot that we now also stall when we have issued exactly issue_rate instructions, so in this case we also need to recheck the DFA, not only after the data dependency stall. So the last patch should be amended like below. diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index edd6cb9..2f721fb 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -6990,7 +6990,7 @@ reset_sched_cycles_in_current_ebb (void) { int cost, haifa_cost; int sort_p; - bool asm_p, real_insn, after_stall; + bool asm_p, real_insn, after_stall, all_issued; int clock; if (!INSN_P (insn)) @@ -7026,8 +7026,8 @@ reset_sched_cycles_in_current_ebb (void) haifa_cost = cost; after_stall = 1; } - if (haifa_cost == 0 - && issued_insns == issue_rate) + all_issued = issued_insns == issue_rate; + if (haifa_cost == 0 && all_issued) haifa_cost = 1; if (haifa_cost > 0) { @@ -7059,7 +7059,7 @@ reset_sched_cycles_in_current_ebb (void) become unavailable to the DFA restrictions. Looks strange but happens e.g. on x86-64. So recheck DFA on the last iteration. */ - if (after_stall + if ((after_stall || all_issued) && real_insn && haifa_cost == 0) haifa_cost = estimate_insn_cost (insn, curr_state);