Fix divide by zero error.

Passes bootstrap and regression tests. Ok for google branches?

Teresa

2012-09-10  Teresa Johnson  <tejohn...@google.com>

        * loop-unroll.c (code_size_limit_factor):

Index: loop-unroll.c
===================================================================
--- loop-unroll.c       (revision 191138)
+++ loop-unroll.c       (working copy)
@@ -223,7 +223,8 @@ code_size_limit_factor(struct loop *loop)
   /* Next, set the value of the codesize-based unroll factor divisor which in
      most loops will need to be set to a value that will reduce or eliminate
      unrolling/peeling.  */
-  if (profile_info->num_hot_counters < size_threshold * 2)
+  if (profile_info->num_hot_counters < size_threshold * 2
+      && loop->header->count > 0)
     {
       /* For applications that are less than twice the codesize limit, allow
          limited unrolling for very hot loops.  */

--
This patch is available for review at http://codereview.appspot.com/6498112

Reply via email to