From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93242 invoked by alias); 5 Nov 2018 14:40:18 -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 93002 invoked by uid 89); 5 Nov 2018 14:40:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=2889 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Nov 2018 14:40:16 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id CEECE2804EF; Mon, 5 Nov 2018 15:40:14 +0100 (CET) Date: Mon, 05 Nov 2018 14:40:00 -0000 From: Jan Hubicka To: "bin.cheng" Cc: GCC Patches , Richard Biener Subject: Re: [PATCH AutoFDO/2]Treat ZERO as common profile probability/count Message-ID: <20181105144014.mks64anywpivjdxg@kam.mff.cuni.cz> References: <7f153787-f390-4661-92aa-06d47cefbbf5.bin.cheng@linux.alibaba.com> <7002062a-a7fd-4d38-9bb4-10cff9b66b53.bin.cheng@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7002062a-a7fd-4d38-9bb4-10cff9b66b53.bin.cheng@linux.alibaba.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2018-11/txt/msg00251.txt.bz2 diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 4289bc5a004..2b5e3269250 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -218,6 +218,11 @@ public: } + /* Return true if value is zero. */ + bool never_p () const + { + return m_val == 0; + } /* Return true if value has been initialized. */ bool initialized_p () const { @@ -288,9 +293,9 @@ public: } profile_probability operator+ (const profile_probability &other) const { - if (other == profile_probability::never ()) + if (other.never_p ()) return *this; - if (*this == profile_probability::never ()) + if (this->never_p ()) This is not correct change. If you add guessed 0 to precise 0, the result needs to be guessed 0 because we are no longer sure the code will not get executed. This is why all the checks here go explicitly to profile_probability::never. Honza