diff mbox

[google] Fix exception in unroller code size heuristics (issue6498112)

Message ID 20120910141656.0444961439@tjsboxrox.mtv.corp.google.com
State New
Headers show

Commit Message

Teresa Johnson Sept. 10, 2012, 2:16 p.m. UTC
Fix divide by zero error.

Passes bootstrap and regression tests. Ok for google branches?

Teresa

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

	* loop-unroll.c (code_size_limit_factor):


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

Comments

Diego Novillo Sept. 10, 2012, 2:19 p.m. UTC | #1
On Mon, Sep 10, 2012 at 10:16 AM, Teresa Johnson <tejohnson@google.com> wrote:

> 2012-09-10  Teresa Johnson  <tejohnson@google.com>
>
>         * loop-unroll.c (code_size_limit_factor):

OK.


Diego.
diff mbox

Patch

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.  */