From patchwork Tue Nov 14 09:24:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 837758 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-466708-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="h5GWXTjk"; 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 3ybhtJ1Ptdz9s9Y for ; Tue, 14 Nov 2017 20:24:56 +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=dPoiMFSpZoVRQCYHcvHSE2+G/rGL2DeGSN8WafDLPxWqHzYXcSXWS 2/VkN3RVxz2PJlj4AC5845oXs2KaB2ly/rbnVb/I/rFBccj2H64durJyURTuBOcP GDM9KnMMlmbnCOjRJCaTtmnzU+vTUWGGJ5MC+5fhf/GyUiyO4NLVTQ= 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=6Zi2Zf8QfuRH1unmn5mjuyQtjpU=; b=h5GWXTjkckxVPC3VV6JM tR92ivOW8gwCKYhoCLt3KG5euxeL3evuoC5yl+a6meFrAU7YaIObYbIc9cLrDuuo /v+/iK17r1N16UwHDnfVlQXqwg8i3pPkPVkHVM7fs8XKxgDyu/ePca1O+qUZiHHj 7O4rU+Vs8SV8Z6kdnLKiKP8= Received: (qmail 112789 invoked by alias); 14 Nov 2017 09:24:47 -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 112685 invoked by uid 89); 14 Nov 2017 09:24:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, KB_WAM_FROM_NAME_SINGLEWORD, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=dup, e1, UD:shrink-wrap.c, reg-stack.c 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; Tue, 14 Nov 2017 09:24:41 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id A04DF548AF9; Tue, 14 Nov 2017 10:24:38 +0100 (CET) Date: Tue, 14 Nov 2017 10:24:38 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: More frequency removal Message-ID: <20171114092438.GA66392@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Hi, this patch updates tracer, reg-stack and shrink wrap. Bootstrapped/regtested x86_64-linux, comitted. Honza * tracer.c (better_p): Do not compare frequencies. * reg-stack.c (better_edge): Likewise. * shrink-wrap.c (try_shrink_wrapping): Do not convert to gcov counts and back. Index: tracer.c =================================================================== --- tracer.c (revision 254719) +++ tracer.c (working copy) @@ -135,8 +135,6 @@ better_p (const_edge e1, const_edge e2) if (e1->count ().initialized_p () && e2->count ().initialized_p () && ((e1->count () > e2->count ()) || (e1->count () < e2->count ()))) return e1->count () > e2->count (); - if (EDGE_FREQUENCY (e1) != EDGE_FREQUENCY (e2)) - return EDGE_FREQUENCY (e1) > EDGE_FREQUENCY (e2); /* This is needed to avoid changes in the decision after CFG is modified. */ if (e1->src != e2->src) Index: reg-stack.c =================================================================== --- reg-stack.c (revision 254719) +++ reg-stack.c (working copy) @@ -2954,11 +2954,6 @@ better_edge (edge e1, edge e2) if (!e1) return e2; - if (EDGE_FREQUENCY (e1) > EDGE_FREQUENCY (e2)) - return e1; - if (EDGE_FREQUENCY (e1) < EDGE_FREQUENCY (e2)) - return e2; - if (e1->count () > e2->count ()) return e1; if (e1->count () < e2->count ()) Index: shrink-wrap.c =================================================================== --- shrink-wrap.c (revision 254719) +++ shrink-wrap.c (working copy) @@ -880,19 +880,18 @@ try_shrink_wrapping (edge *entry_edge, r the correct answer for reducible flow graphs; for irreducible flow graphs our profile is messed up beyond repair anyway. */ - gcov_type num = 0; - gcov_type den = 0; + profile_count num = profile_count::zero (); + profile_count den = profile_count::zero (); FOR_EACH_EDGE (e, ei, pro->preds) if (!dominated_by_p (CDI_DOMINATORS, e->src, pro)) { - num += EDGE_FREQUENCY (e); - den += e->src->count.to_frequency (cfun); + if (e->count ().initialized_p ()) + num += e->count (); + if (e->src->count.initialized_p ()) + den += e->src->count; } - if (den == 0) - den = 1; - /* All is okay, so do it. */ crtl->shrink_wrapped = true; @@ -919,8 +918,9 @@ try_shrink_wrapping (edge *entry_edge, r if (dump_file) fprintf (dump_file, "Duplicated %d to %d\n", bb->index, dup->index); - - bb->count = bb->count.apply_scale (num, den); + + if (num == profile_count::zero () || den.nonzero_p ()) + bb->count = bb->count.apply_scale (num, den); dup->count -= bb->count; }