Index: modulo-sched.c =================================================================== --- modulo-sched.c (revision 130895) +++ modulo-sched.c (working copy) @@ -688,7 +688,22 @@ emit_insn (copy_rtx (PATTERN (reg_move))); if (SCHED_STAGE (u_node) >= from_stage && SCHED_STAGE (u_node) <= to_stage) - duplicate_insn_chain (u_node->first_note, u_node->insn); + { + /* The note will get removed from insn stream in fixup. */ + emit_note (NOTE_INSN_DELETED); + /* Avoid coping reg-moves that were created for the body of + the loop. */ + if (u_node->first_note != u_node->insn) + { + rtx insn; + + for (insn = u_node->first_note; insn != u_node->insn; + insn = NEXT_INSN (insn)) + if (NOTE_P (insn)) + emit_note_copy (insn); + } + emit_copy_of_insn_after (u_node->insn, get_last_insn ()); + } } } @@ -794,7 +809,11 @@ { if (loop->inner || !loop_outer (loop)) + { + if (dump_file) + fprintf (dump_file, "SMS loop inner or !loop_outer\n"); return false; + } if (!single_exit (loop)) { @@ -910,6 +929,12 @@ We use loop->num as index into this array. */ g_arr = XCNEWVEC (ddg_ptr, number_of_loops ()); + if (dump_file) + { + fprintf (dump_file, "\n\nSMS analysis phase\n"); + fprintf (dump_file, "===================\n\n"); + } + /* Build DDGs for all the relevant loops and hold them in G_ARR indexed by the loop index. */ FOR_EACH_LOOP (li, loop, 0) @@ -926,11 +951,24 @@ break; } + if (dump_file) + { + rtx insn = BB_END (loop->header); + + fprintf (dump_file, "SMS loop num: %d, file: %s, line: %d\n", + loop->num, insn_file (insn), insn_line (insn)); + + } + if (! loop_canon_p (loop)) continue; if (! loop_single_full_bb_p (loop)) + { + if (dump_file) + fprintf (dump_file, "SMS not loop_single_full_bb_p\n"); continue; + } bb = loop->header; @@ -971,7 +1009,11 @@ /* Make sure this is a doloop. */ if ( !(count_reg = doloop_register_get (head, tail))) + { + if (dump_file) + fprintf (dump_file, "SMS doloop_register_get failed\n"); continue; + } /* Don't handle BBs with calls or barriers, or !single_set insns, or auto-increment insns (to avoid creating invalid reg-moves @@ -1021,7 +1063,15 @@ } g_arr[loop->num] = g; + if (dump_file) + fprintf (dump_file, "...OK\n"); + } + if (dump_file) + { + fprintf (dump_file, "\nSMS transformation phase\n"); + fprintf (dump_file, "=========================\n\n"); + } /* We don't want to perform SMS on new loops - created by versioning. */ FOR_EACH_LOOP (li, loop, 0) @@ -1036,8 +1086,15 @@ continue; if (dump_file) - print_ddg (dump_file, g); + { + rtx insn = BB_END (loop->header); + fprintf (dump_file, "SMS loop num: %d, file: %s, line: %d\n", + loop->num, insn_file (insn), insn_line (insn)); + + print_ddg (dump_file, g); + } + get_ebb_head_tail (loop->header, loop->header, &head, &tail); latch_edge = loop_latch_edge (loop);