From patchwork Sat Nov 16 09:55:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1196078 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-513771-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="JIK3ql32"; 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 47FVwQ6231z9sP6 for ; Sat, 16 Nov 2019 20:56:04 +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=cBOKDv9lmIdbPg9ZeEWywSFnWhVoncFNBz3R2bE8Qs+RgRwxBm2/c xOez3bDMkLWezGw6B0Qq6nPNYU9bMGImpOqfR3yLIpvV5i8xEH9ckKDK9YBSir2T FNyDtg74a0+kAhQd5mpLhWBcZ4apXf+DcY6VkXq2r91leL4Gqkm60w= 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=efinX+/udiL/Nl4EvI5O4p8EKGg=; b=JIK3ql32D7pu14mAT5iX MPTvPdgBZYkCs4u6vE+G6bQij9FntLLhesx+C+vz2S9NBQnREmZa4Ezy76vMSqVt yNlD885sKZJk9otQg+Nz2PTzwyicpeTgNPu6YUYclvM91bEAcJfX0azdXanyP+ld mqEOVgLhwLyXDhKgLN6lvfw= Received: (qmail 42930 invoked by alias); 16 Nov 2019 09:55:55 -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 42917 invoked by uid 89); 16 Nov 2019 09:55:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy=aged, nonspec_time, sk:edge_gr, sk:reset_n 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; Sat, 16 Nov 2019 09:55:51 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 41ED2283141; Sat, 16 Nov 2019 10:55:49 +0100 (CET) Date: Sat, 16 Nov 2019 10:55:49 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix uncached nonspec_time in inliner Message-ID: <20191116095549.q4aaaqltmcyxn22f@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this patch fixes quite embarasing and aged bug that do_estimate_edge_time does not return correct nonspec_time first time it is executed (when value is not in cache). This does not really have effect on generated code because inliner computes the value twice but it does increase fibonaci heap overhead because priorities are calculated wrong first time around. Bootstrapped/regtested x86_64-linux, comitted. Honza * ipa-inline.h (do_estimate_edge_time): Add nonspec_time parameter. (estimate_edge_time): Use it. * ipa-inine-analysis.c (do_estimate_edge_time): Add ret_nonspec_time parameter. Index: ipa-inline.h =================================================================== --- ipa-inline.h (revision 278306) +++ ipa-inline.h (working copy) @@ -46,7 +46,7 @@ int estimate_size_after_inlining (struct int estimate_growth (struct cgraph_node *); bool growth_positive_p (struct cgraph_node *, struct cgraph_edge *, int); int do_estimate_edge_size (struct cgraph_edge *edge); -sreal do_estimate_edge_time (struct cgraph_edge *edge); +sreal do_estimate_edge_time (struct cgraph_edge *edge, sreal *nonspec_time = NULL); ipa_hints do_estimate_edge_hints (struct cgraph_edge *edge); void reset_node_cache (struct cgraph_node *node); void initialize_growth_caches (); @@ -99,7 +99,7 @@ estimate_edge_time (struct cgraph_edge * if (edge_growth_cache == NULL || (entry = edge_growth_cache->get (edge)) == NULL || entry->time == 0) - return do_estimate_edge_time (edge); + return do_estimate_edge_time (edge, nonspec_time); if (nonspec_time) *nonspec_time = edge_growth_cache->get (edge)->nonspec_time; return entry->time; Index: ipa-inline-analysis.c =================================================================== --- ipa-inline-analysis.c (revision 278306) +++ ipa-inline-analysis.c (working copy) @@ -179,7 +179,7 @@ simple_edge_hints (struct cgraph_edge *e size, since we always need both metrics eventually. */ sreal -do_estimate_edge_time (struct cgraph_edge *edge) +do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time) { sreal time, nonspec_time; int size; @@ -275,6 +275,8 @@ do_estimate_edge_time (struct cgraph_edg hints |= simple_edge_hints (edge); entry->hints = hints + 1; } + if (ret_nonspec_time) + *ret_nonspec_time = nonspec_time; return time; }