--- gcc/modulo-sched.c (/gcc-local/trunk) (revision 30596) +++ gcc/modulo-sched.c (/gcc-local/export-ddg) (revision 30596) @@ -793,6 +803,10 @@ canon_loop (struct loop *loop) /* Used to calculate the upper bound of ii. */ #define MAXII_FACTOR 2 +/* Maximal ASAP saved for estimating maxII. */ +static int global_max_asap; + + /* Main entry point, perform SMS scheduling on the loops of the function that consist of single basic blocks. */ static void @@ -1019,9 +1033,10 @@ sms_schedule (void) node_order = XNEWVEC (int, g->num_nodes); mii = 1; /* Need to pass some estimate of mii. */ + global_max_asap = 0; rec_mii = sms_order_nodes (g, mii, node_order); mii = MAX (res_MII (g), rec_mii); - maxii = MAXII_FACTOR * mii; + maxii = MAX (global_max_asap, MAXII_FACTOR * mii); if (dump_file) fprintf (dump_file, "SMS iis %d %d %d (rec_mii, mii, maxii)\n", @@ -1681,6 +1703,7 @@ calculate_order_params (ddg_ptr g, int m } } + global_max_asap = max_asap; return node_order_params_arr; }