From patchwork Tue Dec 10 18:04:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1207195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515630-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ITpOnBXu"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47XSck2TKxz9sPK for ; Wed, 11 Dec 2019 05:04:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=sWrqIrhDzRFqIjfoRv7LpCp3PzNMiKqnBQnW1BXNwU5GxR+WIYlxD Pmhtrg21FPSWFXRd+6eQIVcV7j2Bf9icfNzZnGeufXPxIc07TCBPjU4QhZMz/uHz gO8bDTnxabbKEl/CSv8Njh9dICnX0WUdOkeONjFMEDE0Uek7o/tUhE= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=H2CdS12wGY2JsKAIoPFSk8oLgBo=; b=ITpOnBXuyH8OCDjo8B7d HySyyhXd8lUYmtmw+Rl0EuI2w8xW3gph82OGCBp3O8M1pObIwILwqA4qPJ4YANEB X3cDXArh/xAmLVEVckE5XEQpKuyfydOYCaqTPKkdSKJADrEikjreRkMdFQSwZApt AYN6gyh5rHG2Be5SRpbTNHU= Received: (qmail 18091 invoked by alias); 10 Dec 2019 18:04:15 -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 18076 invoked by uid 89); 10 Dec 2019 18:04:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= 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; Tue, 10 Dec 2019 18:04:14 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 162EF28082C; Tue, 10 Dec 2019 19:04:12 +0100 (CET) Date: Tue, 10 Dec 2019 19:04:12 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix function profile computation Message-ID: <20191210180412.qzh6nuzogdics2ua@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this patch fixes compute_function_frequency to work well with profiles that was downgraded from IPA to local profiles. Bootstrapped/regtested x86_64-linux, comitted. honza * predict.c (compute_function_frequency): Check for presence of IPA profile. Index: predict.c =================================================================== --- predict.c (revision 279167) +++ predict.c (working copy) @@ -3932,13 +3932,11 @@ compute_function_frequency (void) if (DECL_STATIC_DESTRUCTOR (current_function_decl)) node->only_called_at_exit = true; - if (profile_status_for_fn (cfun) != PROFILE_READ) + if (!ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa_p ()) { int flags = flags_from_decl_or_type (current_function_decl); - if ((ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa_p () - && ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa() == profile_count::zero ()) - || lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl)) - != NULL) + if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl)) + != NULL) { node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED; warn_function_cold (current_function_decl);