From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21905 invoked by alias); 21 Dec 2011 16:49:45 -0000 Received: (qmail 21883 invoked by uid 22791); 21 Dec 2011 16:49:39 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Dec 2011 16:49:18 +0000 Received: by iakh37 with SMTP id h37so9220649iak.20 for ; Wed, 21 Dec 2011 08:49:18 -0800 (PST) Received: by 10.42.156.9 with SMTP id x9mr7819023icw.50.1324486157976; Wed, 21 Dec 2011 08:49:17 -0800 (PST) Received: by 10.42.156.9 with SMTP id x9mr7819002icw.50.1324486157773; Wed, 21 Dec 2011 08:49:17 -0800 (PST) Received: from coign.google.com ([2620:0:1000:147c:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id cv10sm25585366igc.0.2011.12.21.08.49.16 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Dec 2011 08:49:16 -0800 (PST) From: Ian Lance Taylor To: Scott Meyers Cc: gcc-help@gcc.gnu.org Subject: Re: __builtin_expect vs. PGO References: Date: Wed, 21 Dec 2011 16:56:00 -0000 In-Reply-To: (Scott Meyers's message of "Tue, 20 Dec 2011 22:15:06 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-12/txt/msg00200.txt.bz2 Scott Meyers writes: > What has more weight during codegen in a compilation with > -fprofile-use when the code uses __builtin_expect to favor one branch > while the PGO data says the other branch is more likely? I believe the probabilities will be combined in that case. The weighting of __builtin_expect is such that it will most likely be the predicted case, unless the profiling data says that the unexpected path is always taken. Ian