From patchwork Wed Nov 7 12:11:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 994215 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-489234-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="S982wX++"; 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 42qldQ3rx1z9sCw for ; Wed, 7 Nov 2018 23:11:36 +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:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=uEgwxiJyIy+9pJk9IMDXpPYfu/Nh6arQPhHhPA1nKd0nkfmAgk S4SAsNTXB3rkkvgxmWE+YAAdQ2tFLkclicjI43lGMe8tiQP3dysr6hC/gHAre4/l yLV8aN2LPlo2jeav0iH6HhL3cXiy7c+Qw8SynamuhwGu9y+A01pIU4aiM= 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:cc:subject:message-id:mime-version:content-type; s= default; bh=WR3agCz1cUvVUiN8mW7f1cLG+QE=; b=S982wX++krQHOnf5kvll /m/FGLxXTuOS0llKSDMDAVX/lBjFAwL29Q/762UepRQthxC9+nvk5hSS5eJgKgU1 ZyMhpqGTH8ZTkFH0whTEW0S+wcTPVrg15dv53Ie95X0Zqh9Y6YrOkGn0LN7J9Nu5 ZhMtg2SbBPGzvtf0A/dvWfo= Received: (qmail 6195 invoked by alias); 7 Nov 2018 12:11:28 -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 6186 invoked by uid 89); 7 Nov 2018 12:11:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.9 required=5.0 tests=BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=growth, Upgrade, Reduce, offenders X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Nov 2018 12:11:26 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 531A3AD9D; Wed, 7 Nov 2018 12:11:24 +0000 (UTC) Date: Wed, 7 Nov 2018 13:11:24 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jan Hubicka Subject: [PATCH] Reduce number of sreal operator* calls Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 This reduces the number of $subject calls by computing big_speedup_p lazily. This caller accounts for roughly a quarter of all operator* calls for PR38474 and operator* is top of the profile of the whole compilation. Next offenders (callers) are compute_inlined_call_time and edge_badness. profile_count::to_sreal_scale is also quite bad in performance btw (probably due to the sreal division). Bootstrap/regtest in progress. OK? Thanks, Richard. 2018-11-07 Richard Biener * ipa-inline.c (want_inline_small_function_p): Compute big_speedup_p lazily and last. Index: gcc/ipa-inline.c =================================================================== --- gcc/ipa-inline.c (revision 265860) +++ gcc/ipa-inline.c (working copy) @@ -779,7 +779,7 @@ want_inline_small_function_p (struct cgr { int growth = estimate_edge_growth (e); ipa_hints hints = estimate_edge_hints (e); - bool big_speedup = big_speedup_p (e); + int big_speedup = -1; /* compute this lazily */ if (growth <= 0) ; @@ -787,13 +787,13 @@ want_inline_small_function_p (struct cgr hints suggests that inlining given function is very profitable. */ else if (DECL_DECLARED_INLINE_P (callee->decl) && growth >= MAX_INLINE_INSNS_SINGLE - && ((!big_speedup - && !(hints & (INLINE_HINT_indirect_call + && (growth >= MAX_INLINE_INSNS_SINGLE * 16 + || (!(hints & (INLINE_HINT_indirect_call | INLINE_HINT_known_hot | INLINE_HINT_loop_iterations | INLINE_HINT_array_index - | INLINE_HINT_loop_stride))) - || growth >= MAX_INLINE_INSNS_SINGLE * 16)) + | INLINE_HINT_loop_stride)) + && !(big_speedup = big_speedup_p (e))))) { e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT; want_inline = false; @@ -813,7 +813,6 @@ want_inline_small_function_p (struct cgr Upgrade it to MAX_INLINE_INSNS_SINGLE when hints suggests that inlining given function is very profitable. */ else if (!DECL_DECLARED_INLINE_P (callee->decl) - && !big_speedup && !(hints & INLINE_HINT_known_hot) && growth >= ((hints & (INLINE_HINT_indirect_call | INLINE_HINT_loop_iterations @@ -821,7 +820,8 @@ want_inline_small_function_p (struct cgr | INLINE_HINT_loop_stride)) ? MAX (MAX_INLINE_INSNS_AUTO, MAX_INLINE_INSNS_SINGLE) - : MAX_INLINE_INSNS_AUTO)) + : MAX_INLINE_INSNS_AUTO) + && !(big_speedup == -1 ? big_speedup_p (e) : big_speedup)) { /* growth_likely_positive is expensive, always test it last. */ if (growth >= MAX_INLINE_INSNS_SINGLE