--- gcc/modulo-sched.c (/gcc-local/trunk) (revision 30596) +++ gcc/modulo-sched.c (/gcc-local/export-ddg) (revision 30596) @@ -1425,32 +1440,39 @@ sms_schedule_by_order (ddg_ptr g, int mi "Trying to schedule node %d in (%d .. %d) step %d\n", u, start, end, step); - /* use must_follow & must_precede bitmaps to determine order - of nodes within the cycle. */ - sbitmap_zero (must_precede); - sbitmap_zero (must_follow); - /* TODO: We can add an insn to the must_precede or must_follow - bitmaps only if it has tight dependence to U and they - both scheduled in the same row. The current check is less - conservative and content with the fact that both U and the - insn are scheduled in the same row. */ - for (e = u_node->in; e != 0; e = e->next_in) - if (TEST_BIT (sched_nodes, e->src->cuid) - && (SMODULO (SCHED_TIME (e->src), ii) == SMODULO (start, ii))) - SET_BIT (must_precede, e->src->cuid); - - for (e = u_node->out; e != 0; e = e->next_out) - if (TEST_BIT (sched_nodes, e->dest->cuid) - && (SMODULO (SCHED_TIME (e->dest), ii) == - SMODULO ((end - step), ii))) - SET_BIT (must_follow, e->dest->cuid); - success = 0; if ((step > 0 && start < end) || (step < 0 && start > end)) for (c = start; c != end; c += step) { ps_insn_ptr psi; + /* use must_follow & must_precede bitmaps to determine order + of nodes within the cycle. */ + sbitmap_zero (must_precede); + sbitmap_zero (must_follow); + /* TODO: We can add an insn to the must_precede or must_follow + bitmaps only if it has tight dependence to U and they + both scheduled in the same row. The current check is less + conservative and content with the fact that both U and the + insn are scheduled in the same row. */ + for (e = u_node->in; e != 0; e = e->next_in) + if (TEST_BIT (sched_nodes, e->src->cuid)) + { + if (e->type == ANTI_DEP) + SET_BIT (must_precede, e->src->cuid); + else if (e->type == TRUE_DEP) + SET_BIT (must_follow, e->src->cuid); + } + + for (e = u_node->out; e != 0; e = e->next_out) + if (TEST_BIT (sched_nodes, e->dest->cuid)) + { + if (e->type == ANTI_DEP) + SET_BIT (must_follow, e->dest->cuid); + else if (e->type == TRUE_DEP) + SET_BIT (must_precede, e->dest->cuid); + } + psi = ps_add_node_check_conflicts (ps, u_node, c, must_precede, must_follow);