https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87979

--- Comment #2 from Roman Zhuykov <zhroma at ispras dot ru> ---
Situation is same in the following tests on ia64 platform with -fmodulo-sched
enabled (with any of O1, O2, Os):
gcc.dg/torture/pr82762.c
gcc.c-torture/execute/20170419-1.c

We divide by zero when we try to schedule loop body in zero cycles. Both
res_mii and rec_mii estimations equals zero. We have to start with one cycle in
this situation.

Patch was successfully bootstrapped and regtested with few other patches on
x86_64. In cross-compiler mode to s390, spu, aarch64, arm, ia64, ppc and ppc64
patch was regtested, and also with -fmodulo-sched enabled by default.
All same testing also done on 8 branch. Mentioned ia64 tests were the only
difference.

diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -1597,6 +1597,7 @@ sms_schedule (void)
       mii = 1; /* Need to pass some estimate of mii.  */
       rec_mii = sms_order_nodes (g, mii, node_order, &max_asap);
       mii = MAX (res_MII (g), rec_mii);
+      mii = MAX (mii, 1);
       maxii = MAX (max_asap, MAXII_FACTOR * mii);

       if (dump_file)

Reply via email to