From patchwork Thu Nov 23 16:02:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 840829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-467799-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Sc/Ia735"; 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 3yjPHN0q3qz9s72 for ; Fri, 24 Nov 2017 03:02:54 +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=x3NoiXcOl3QBEp29ExikWxAp88hgjUfw8AWYmsotwGXCVvZNDmQVM 7vNNiRjZxcIqb98W57J3fA96WUXF50FfboQya/JuNOcJwhE0jFgWw0x3sdead/f2 OWjSBF8kD0R6OQrsQhOe2AerBTfE+4Ei4ApwtDxJmZzlT6S38X0s2Y= 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=TfEXAck3ROexOdNuC64Xf3pWNwE=; b=Sc/Ia735oRy6YXErc0gs hhaAfSjgkT11HC76Gz7stMyYSee22pDC02Vs1w46dY8x78PPdxvmnWD5V0uqN7WI l/lhiiQMLr8lC7qduQiCbaI8oWN+qMzL34lNdAmhUwKtPDAn92dzYdEzdyEedSWS LhuQr9eEsWyYC2o5J4Oz0W4= Received: (qmail 117630 invoked by alias); 23 Nov 2017 16:02:46 -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 117583 invoked by uid 89); 23 Nov 2017 16:02:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KB_WAM_FROM_NAME_SINGLEWORD, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1026 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; Thu, 23 Nov 2017 16:02:40 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 9DF75548E94; Thu, 23 Nov 2017 17:02:37 +0100 (CET) Date: Thu, 23 Nov 2017 17:02:37 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix profile update when producing inline clone Message-ID: <20171123160237.GA71650@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Hi, while updating cgraph_node::create_clone I forgot that it also is used to create inline clones. In that case we can not preserve original local count even if prof_count is 0. Bootstrapped/regtested x86_64-linux, comitted. Honza * cgraphclones.c (cgraph_node::create_clone): Fix updating of profile when inlining. Index: cgraphclones.c =================================================================== --- cgraphclones.c (revision 255053) +++ cgraphclones.c (working copy) @@ -428,7 +428,10 @@ cgraph_node::create_clone (tree new_decl if (new_inlined_to) dump_callgraph_transformation (this, new_inlined_to, "inlining to"); - prof_count = count.combine_with_ipa_count (prof_count); + /* When inlining we scale precisely to prof_count, when cloning we can + preserve local profile. */ + if (!new_inlined_to) + prof_count = count.combine_with_ipa_count (prof_count); new_node->count = prof_count; /* Update IPA profile. Local profiles need no updating in original. */