From patchwork Sun Aug 2 13:02:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1339914 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BKLlN2tgtz9sSG for ; Sun, 2 Aug 2020 23:02:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51A0C3858D38; Sun, 2 Aug 2020 13:02:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id EC5293858D35 for ; Sun, 2 Aug 2020 13:02:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EC5293858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7F23E280875; Sun, 2 Aug 2020 15:02:15 +0200 (CEST) Date: Sun, 2 Aug 2020 15:02:15 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, mliska@suse.cz Subject: Fix remove_predictions_associated_with_edge Message-ID: <20200802130215.GA53029@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-19.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, remove_predictions_associated_with_edge currently calls filter_predicitons passing it equal_edge_p. Becase filter_predictions removes all edges where filter returns false, the function does exact oposite. Fixed thus. Bootstrapped/regtested x86_64-linux. gcc/ChangeLog: 2020-08-02 Jan Hubicka * predict.c (filter_predictions): Document semantics of filter. (equal_edge_p): Rename to ... (not_equal_edge_p): ... this; reverse semantics. (remove_predictions_associated_with_edge): Fix. diff --git a/gcc/predict.c b/gcc/predict.c index 0a317a7a4ac..2164a06e083 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -595,10 +595,11 @@ gimple_predict_edge (edge e, enum br_predictor predictor, int probability) } } -/* Filter edge predictions PREDS by a function FILTER. DATA are passed - to the filter function. */ +/* Filter edge predictions PREDS by a function FILTER: if FILTER return false + the prediction is removed. + DATA are passed to the filter function. */ -void +static void filter_predictions (edge_prediction **preds, bool (*filter) (edge_prediction *, void *), void *data) { @@ -627,10 +628,10 @@ filter_predictions (edge_prediction **preds, /* Filter function predicate that returns true for a edge predicate P if its edge is equal to DATA. */ -bool -equal_edge_p (edge_prediction *p, void *data) +static bool +not_equal_edge_p (edge_prediction *p, void *data) { - return p->ep_edge == (edge)data; + return p->ep_edge != (edge)data; } /* Remove all predictions on given basic block that are attached @@ -642,7 +643,7 @@ remove_predictions_associated_with_edge (edge e) return; edge_prediction **preds = bb_predictions->get (e->src); - filter_predictions (preds, equal_edge_p, e); + filter_predictions (preds, not_equal_edge_p, e); } /* Clears the list of predictions stored for BB. */