From patchwork Sun Nov 3 16:01:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1188577 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-512277-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="cuNoaOuw"; 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 475gdt28Fcz9sP3 for ; Mon, 4 Nov 2019 03:01:19 +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=ChyzNc1MosDaPg1g1Uvoldf/gykrrroZtsq3DLHH3BpkK5AM/sYlW scvP7AAj5vM3UKWnRuKCNr455DDe9yoobzJp7Numu7yUDmf6zsdW7BYKOzGddUjU 4MN+SPzfpEij2wHHTSGWOfa48UvSbFoA4TpHk8nuGKa/bwnubypIwM= 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=ft7wK9DzF2AhCumuoIC/EurRRe8=; b=cuNoaOuwgLG4P6m1Elks c+lf2ZH1oeHrBIca4LUsPgFTXgAH/Jg2woLcD7JNeio6tuziErZVFwCvJ1ZjVO1w xdg07sbPIl3Wev43YDB36YzU0dL+6oyo2R02BX3gkQh73FFnWVA+kh3mEw96DsGQ kOqDlElMEFCkNj0OZkRdyNQ= Received: (qmail 79708 invoked by alias); 3 Nov 2019 16:01:11 -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 79652 invoked by uid 89); 3 Nov 2019 16:01:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=streaming 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; Sun, 03 Nov 2019 16:01:03 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id B84EC282BE8; Sun, 3 Nov 2019 17:01:00 +0100 (CET) Date: Sun, 3 Nov 2019 17:01:00 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Optimize streaming in inline summaries Message-ID: <20191103160100.floeihhlggpnkkb5@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this patch makes inline_read_sections to allocate vector in proper size saving bit of register scaling overhead. Bootstrapped/regtested x86_64-linux, comitted. * ipa-fnsummary.c (inline_read_section): Set vector size ahead of time. Index: ipa-fnsummary.c =================================================================== --- ipa-fnsummary.c (revision 277754) +++ ipa-fnsummary.c (working copy) @@ -3614,6 +3614,8 @@ inline_read_section (struct lto_file_dec count2 = streamer_read_uhwi (&ib); gcc_assert (!info || !info->conds); + if (info) + vec_safe_reserve_exact (info->conds, count2); for (j = 0; j < count2; j++) { struct condition c; @@ -3627,8 +3629,10 @@ inline_read_section (struct lto_file_dec c.by_ref = bp_unpack_value (&bp, 1); if (c.agg_contents) c.offset = streamer_read_uhwi (&ib); - c.param_ops = NULL; count3 = streamer_read_uhwi (&ib); + c.param_ops = NULL; + if (info) + vec_safe_reserve_exact (c.param_ops, count3); for (k = 0; k < count3; k++) { struct expr_eval_op op; @@ -3658,13 +3662,16 @@ inline_read_section (struct lto_file_dec fatal_error (UNKNOWN_LOCATION, "invalid fnsummary in LTO stream"); } - vec_safe_push (c.param_ops, op); + if (info) + c.param_ops->quick_push (op); } if (info) - vec_safe_push (info->conds, c); + info->conds->quick_push (c); } count2 = streamer_read_uhwi (&ib); gcc_assert (!info || !info->size_time_table); + if (info && count2) + vec_safe_reserve_exact (info->size_time_table, count2); for (j = 0; j < count2; j++) { class size_time_entry e; @@ -3675,7 +3682,7 @@ inline_read_section (struct lto_file_dec e.nonconst_predicate.stream_in (&ib); if (info) - vec_safe_push (info->size_time_table, e); + info->size_time_table->quick_push (e); } p.stream_in (&ib);