From patchwork Mon Sep 10 14:16:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 182896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 42D522C0090 for ; Tue, 11 Sep 2012 00:17:22 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1347891443; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=5Rm/DKI X0zOEkoyoRJlTrmskn88=; b=oVma39qqVOm5Tdu2Ghv2u4bYlwgv7E7/MYCLIMT KKVUI6gbWFNMc0unj+uSoJc4mnMWeC4qWgM31BP9c3B9XANPFOlGKL9nPa05qy88 qDV3wh1CzafDaHv8a1LEQLFgv9EjzBvMf4lC2jUl7/hdbcmh3T1b5aWNI1WKnHeq +GUA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=le+ZrSG8HYroD1D6W712D0qP3aTGK5dH0YO9mJ+woL8/j9W1S13cIUeEB21eCw Peg0dmfTczBV8Fne0lNTeyZbJwTu/tdgfTF5EzbGV2oHyQrUC9tW9UiWkWXv/zxQ +1uDPhmk6hgMnKPdOJI3W1b4k5/TniAaF63NVe8txxbgs=; Received: (qmail 19099 invoked by alias); 10 Sep 2012 14:17:14 -0000 Received: (qmail 19088 invoked by uid 22791); 10 Sep 2012 14:17:12 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, URIBL_DBL_REDIR X-Spam-Check-By: sourceware.org Received: from mail-gh0-f201.google.com (HELO mail-gh0-f201.google.com) (209.85.160.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Sep 2012 14:16:57 +0000 Received: by ghbz17 with SMTP id z17so212778ghb.2 for ; Mon, 10 Sep 2012 07:16:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=StIv7bXhZ4WAUcdgeJ25vR3hGHTplo4BxXBaLWa+6Ck=; b=ZXrISejVU6I8HyzjbfUcvDGUQKRyqxrLvarE2Fk6H+eDIpdjbXgn6TdJsPA2zsnuKB FWRW978Vnk4+g7ljV4EZX9WhcgjD47yzs6HU+4EMYVYqcQjHsJT9fRCGOKSzOmxQAPxH vXnaubnKJG+bgFFho5rhAzr7D4WAStXUITerHFjTWPFaF3YmtjR4eAqMApAd/m9epl3n 6JGtcDIorqarjde2SZAc8S1LIjGzPjRwHI3iSGPhmePuH2nORNeKsZJbTzt4UN//24o2 jpV8n8m95bYK3rLWsEXfv4Uz0cogkv47BLU6edu5+NlhholgABQ2FT3n1SIriNvYd3Qk n3gw== Received: by 10.236.200.194 with SMTP id z42mr8392215yhn.13.1347286616766; Mon, 10 Sep 2012 07:16:56 -0700 (PDT) Received: by 10.236.200.194 with SMTP id z42mr8392211yhn.13.1347286616713; Mon, 10 Sep 2012 07:16:56 -0700 (PDT) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id l49si3861742yhe.1.2012.09.10.07.16.56 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 10 Sep 2012 07:16:56 -0700 (PDT) Received: from tjsboxrox.mtv.corp.google.com (tjsboxrox.mtv.corp.google.com [172.18.110.68]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 9A04A1E0043; Mon, 10 Sep 2012 07:16:56 -0700 (PDT) Received: by tjsboxrox.mtv.corp.google.com (Postfix, from userid 147431) id 0444961439; Mon, 10 Sep 2012 07:16:55 -0700 (PDT) To: reply@codereview.appspotmail.com, davidxl@google.com, gcc-patches@gcc.gnu.org Subject: [google] Fix exception in unroller code size heuristics (issue6498112) Message-Id: <20120910141656.0444961439@tjsboxrox.mtv.corp.google.com> Date: Mon, 10 Sep 2012 07:16:55 -0700 (PDT) From: tejohnson@google.com (Teresa Johnson) X-Gm-Message-State: ALoCoQnMD/9ZmcShVY+hOXvA73Mb3ljGyKppuD7ojoX5Y7IAAfqY+kiO5eVZ2a8RcREKGlcg3JyEQARKsAKkq510ycYwj+0ng7QS4rad4AGE4JRpH383PNoghZ65ivgo1beSlggVnBAU1i+5KQR9TyzkbFmXLejgO53nOI/PlpcCQJqVOmeyrh4GjEmgAvIQ0BkCcbqTIO35 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Fix divide by zero error. Passes bootstrap and regression tests. Ok for google branches? Teresa 2012-09-10 Teresa Johnson * loop-unroll.c (code_size_limit_factor): --- This patch is available for review at http://codereview.appspot.com/6498112 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. */