From patchwork Thu Apr 11 20:56:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 235927 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 0C2BD2C00C7 for ; Fri, 12 Apr 2013 06:56:47 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=PNRkHPGSqy+Pay3BKzcq+6W/+jiiJ88jWNh29M1qkMW fAD4tQxQe4PRJCJJ3agiYJXIxUmac3G0AAVDjNS2kVkwpLS0mJO6tvunybybhz4r XWYeFIB+wiojMvHD0lyupSnoI1xU5z1RWb30lEnDNWQaLDc65x7LihVmM4BYGIJU = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=o7ibkxuJvo6iPUze4erBBIMNl5s=; b=vnKavIyiEO6O1Hj3a gbVCuLMPMOOREb0YyOM8p+qzZKpGOiKKPRovDHkcMxlDZh6hap2GwRHlCFa9flg0 ggm7XzzCO+1BYrcH5Smc8hF5wdu2SDLS5p87hc1C02a6hwpcr7B+m8oICZcJ14Kx pfwibf3EybZ+a+q20TVvB1BrGs= Received: (qmail 20488 invoked by alias); 11 Apr 2013 20:56:40 -0000 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 Received: (qmail 20475 invoked by uid 89); 11 Apr 2013 20:56:40 -0000 X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from mail-ee0-f48.google.com (HELO mail-ee0-f48.google.com) (74.125.83.48) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Apr 2013 20:56:39 +0000 Received: by mail-ee0-f48.google.com with SMTP id b15so945312eek.7 for ; Thu, 11 Apr 2013 13:56:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type:x-gm-message-state; bh=OuKIfy8X8a9cGfGR9YFuGbmJ5Qeh0uD04xmUlib7NhI=; b=fw3xGJvQP382V1fhdk3J3EENx4+7Jd4r5qodMpZUGtNLyPJydtf6+EBypSjv5RpE1X 0z3AoKrwk/s5B0vyK1CwR0igVhfNFumqWesPhqTRK0lW3jY+b3pgius5lieKMPKfcafM nFdYUcqKJvAIKvO518cVMl886sVVZm5Vh9WutX+d0/knKH6nsPkOIFFtqoOf9OMOvsSr G+sQmhCSnBluCKr9Vx5cnI/IZ2F/+dsvyx98yFo3AINCBOKXpOVXHTYhu9Ve0TdsDFxn y3rAzRGle2VHi6IPB2d9zVj48SXQJBFa0h6evLSsPuElRu4uLHpdkBLRfTranrD8bYSS X+gA== MIME-Version: 1.0 X-Received: by 10.15.45.136 with SMTP id b8mr20811465eew.11.1365713797127; Thu, 11 Apr 2013 13:56:37 -0700 (PDT) Received: by 10.15.90.193 with HTTP; Thu, 11 Apr 2013 13:56:37 -0700 (PDT) Date: Thu, 11 Apr 2013 13:56:37 -0700 Message-ID: Subject: [Google] Fix the bug in calculating sum_all From: Dehao Chen To: GCC Patches Cc: David Li X-Gm-Message-State: ALoCoQn+FYIXd3wPBG2cmtM3mRDneOF9BiVHc6jofbZ5XrI+exaxgXzXKnaox6r1T86Sh9xgPPxtqEGW2N03pmDQY2XyyurJzV4es08GHsYaE+SnifMsiLGJLa/klgfz4V1M3dcWZk5RSl9HEyuFMKk5U46Ufhq7axA5JykduWlhVPsUPY/o+7zSfH1KkEUcpyrgcVTBdErc Hi, This patch fix the bug of sum_all, which is used in loop unroll. The fix will suppress unrolling loops when the program is hot instruction footprint is large. Bootstrapped and passed regression tests. Is it okay for googe-4_7 branch? Thanks, Dehao --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -1172,8 +1172,7 @@ process_auto_profile (void) { (*func_slot)->entry_count += gcov_functions[i].entry_count; (*func_slot)->total_count += gcov_functions[i].total_count; - if ((*func_slot)->total_count > afdo_profile_info->sum_all) - afdo_profile_info->sum_all = (*func_slot)->total_count; + afdo_profile_info->sum_all += (*func_slot)->total_count; } else *func_slot = gcov_functions + i; @@ -1275,6 +1274,7 @@ init_auto_profile (void) xcalloc (1, sizeof (struct gcov_ctr_summary)); afdo_profile_info->runs = 1; afdo_profile_info->sum_max = 0; + afdo_profile_info->sum_all = 0; /* Read the profile from the profile file. */ read_profile ();