From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103717 invoked by alias); 24 Nov 2017 12:06:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 103694 invoked by uid 89); 24 Nov 2017 12:06:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=among X-Spam-User: qpsmtpd, 2 recipients X-HELO: homiemail-a52.g.dreamhost.com Received: from sub5.mail.dreamhost.com (HELO homiemail-a52.g.dreamhost.com) (208.113.200.129) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Nov 2017 12:06:34 +0000 Received: from homiemail-a52.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a52.g.dreamhost.com (Postfix) with ESMTP id D36F06002C20; Fri, 24 Nov 2017 04:06:31 -0800 (PST) Received: from devel.in.reserved-bit.com (unknown [202.189.238.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by homiemail-a52.g.dreamhost.com (Postfix) with ESMTPSA id C56456002C1B; Fri, 24 Nov 2017 04:06:30 -0800 (PST) From: Siddhesh Poyarekar To: gcc-patches@gcc.gnu.org Cc: hubicka@gcc.gnu.org Subject: [PATCH] [pr#83069] Keep profile_count for bb under real_bb_freq_max Date: Fri, 24 Nov 2017 13:00:00 -0000 Message-Id: <1511525181-25726-1-git-send-email-siddhesh@gotplt.org> X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg02203.txt.bz2 freq_max < 1, i.e. highest frequency among bbs in the function being higher than real_bb_freq_max means that the bb ends up with a profile count larger than real_bb_freq_max and then can go all the way up to and beyond profile_count::max_count. Bootstrapped on aarch64, testsuite in progress. * gcc/predict.c (estimate_bb_frequencies): Don't reset freq_max. * gcc/testsuite/gcc.dg/pr83069.c: New test case. --- gcc/predict.c | 2 -- gcc/testsuite/gcc.dg/pr83069.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr83069.c diff --git a/gcc/predict.c b/gcc/predict.c index 0f34956..ff9b5a9 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -3613,8 +3613,6 @@ estimate_bb_frequencies (bool force) freq_max = BLOCK_INFO (bb)->frequency; freq_max = real_bb_freq_max / freq_max; - if (freq_max < 16) - freq_max = 16; profile_count ipa_count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa (); cfun->cfg->count_max = profile_count::uninitialized (); FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb) diff --git a/gcc/testsuite/gcc.dg/pr83069.c b/gcc/testsuite/gcc.dg/pr83069.c new file mode 100644 index 0000000..d43d78d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr83069.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +void +foo (unsigned long *res, unsigned long in) +{ + for (unsigned long a = 0; a < 98; a++) + for (unsigned long b = 0; b < 98; b++) + for (unsigned long c = 0; c < 98; c++) + for (unsigned long d = 0; d < 98; d++) + for (unsigned long e = 0; e < 98; e++) + for (unsigned long f = 0; f < 98; f++) + for (unsigned long g = 0; g < 98; g++) + *res += a * in; +} -- 2.7.4