From patchwork Fri Jan 17 22:38:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 312211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 EEB7D2C0099 for ; Sat, 18 Jan 2014 09:38:30 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=tQa3hda+vsYbA/TbsI9ppRx4A2Uzb2QlAMgjQa+WcJk UnTBN+u1QQoURYzVC4jxQ0+gdN9HCfYOWM7jkpSNnJd90GGH086EIywuA2IXr59I nTKXqdp9pKIN2lgdddEwaM+F/KlfgtmiLcUyjiT41ZMqEeBrVA81hiIITcFVMZhY = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=SFqyBA3g+Ifnef+2hiE7ZJFkyRU=; b=VyCKy5Cj4cWAvYrmC n1xTKwyZylDC3h/wD4gfHSkD9fSQlYW5MOKxgDPyGOfvq0+ZlaDnonTWsuZVjTA+ isWN3MFO6p07geUcg5OjT0ga2XLFwVz/0pQklJiFijJ5vY0R3wxEkFIxsHQjja0L iSFl2BoL1IqrJYQjgSUyxD4PzM= Received: (qmail 1140 invoked by alias); 17 Jan 2014 22:38:23 -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 1130 invoked by uid 89); 17 Jan 2014 22:38:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f181.google.com Received: from mail-ig0-f181.google.com (HELO mail-ig0-f181.google.com) (209.85.213.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 17 Jan 2014 22:38:22 +0000 Received: by mail-ig0-f181.google.com with SMTP id j1so2883210iga.2 for ; Fri, 17 Jan 2014 14:38:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=FtAKc3r6sMA2x6vMxXmutAtWJ9Ug+k7haK5uHbknLXE=; b=XGO23yZK84EM91jJluAp/pkuOBPxHq/TYmNH3NzfRk9cn6oJnYct4LGNNojZ1k+vAc 9YAkjoV/Im+IYOffoqJzLsFffRHFa5yewTMoZ5RbjgsG85Mr5s2AWQodf04Fp3IrzB1K oAC1LxEU2HQkf2slLn3ff0Zu2xerZDL2OuN2W1Oz9/tLd3kCjWNYxLGgY+5ao6anGpof H9jjZcGHTUlBKvkfbekTJdSJqYF+pr2X8NuHnkGnuTwNBGVyceR39pKyWmCzf5K7BEHQ kK01YOeMm1BCsEcgyWbXta7OenYOa9dEOtVtcLfOozlEV0n3FS9S8xWxBES2UCT5/qtI 7X4A== X-Gm-Message-State: ALoCoQlYk1dmCLgcMqA+pjlBkPdb7S2OB0UeM9zHRZI00gNJUKh3fcmBui8787UiSR+DO07cOQPr2RfsWHVj8WZAmltGDOJL02q4OSIMkOLe7Lkz8dWK5tF1eac0Ecli44NamREt+5jN4dA8r3j0NDPjOpJNk8x6RvgLmlOBqJG8raq9dPYU5fOdk+y4mRuDWdFFHTmhTipZ6TcoVzZbHyQYQSZQpJFMQA== MIME-Version: 1.0 X-Received: by 10.42.32.133 with SMTP id e5mr3985517icd.39.1389998300842; Fri, 17 Jan 2014 14:38:20 -0800 (PST) Received: by 10.64.252.101 with HTTP; Fri, 17 Jan 2014 14:38:20 -0800 (PST) Date: Fri, 17 Jan 2014 14:38:20 -0800 Message-ID: Subject: [GOOGLE] Restrict the count_scale to be no larger than 100% From: Dehao Chen To: GCC Patches Cc: David Li X-IsSubscribed: yes In AutoFDO, sometime edge count might be propagated to be too large due to bad debug info. In this cases, we need to make sure the count scale is no larger than 100% otherwise it'll make real hot code cold. Bootstrapped and passed regression test. Performance test on-going. OK for google-4_8 if performance test is ok? Thanks, Dehao Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 206721) +++ gcc/tree-inline.c (working copy) @@ -2262,6 +2262,9 @@ copy_cfg_body (copy_body_data * id, gcov_type coun else count_scale = REG_BR_PROB_BASE; + if (flag_auto_profile && count_scale > REG_BR_PROB_BASE) + count_scale = REG_BR_PROB_BASE; + /* Register specific tree functions. */ gimple_register_cfg_hooks (); Index: gcc/cgraphclones.c =================================================================== --- gcc/cgraphclones.c (revision 206721) +++ gcc/cgraphclones.c (working copy) @@ -216,7 +216,10 @@ cgraph_clone_node (struct cgraph_node *n, tree dec count, we will not update the original callee because it may mistakenly mark some hot function as cold. */ if (flag_auto_profile && count >= n->count) - update_original = false; + { + update_original = false; + new_node->count = n->count; + } if (update_original) { n->count -= count;