From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 689EF385773F for ; Fri, 7 Jul 2023 17:23:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 689EF385773F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 94819281052; Fri, 7 Jul 2023 19:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1688750606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=UceunqzXUXtdJV+/IHOwUBzWLYtwHUvQnlwGPyk+CAo=; b=Uvjd3P2SZ+GAlZ/N2SoPKxBqPZnphPk5MHGhcPSB0kW7cEesw1CJUV2wQsOsFTtdFEGBHA hC0izYLib5nxIdyfRoYsy+GCYXW/hhTowYZCZOmP7/QtwfVZctCYd0TREWr2gdccUE5t/F l1sh8ldQzJUVoJ+n6BYg6/pq9GCohzI= Date: Fri, 7 Jul 2023 19:23:26 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Cleanup force_edge_cold Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, we can use the new set_edge_probability_and_rescale_others here. Bootstrapped/regtested x86_64-linux, comitted. Honza gcc/ChangeLog: * predict.cc (force_edge_cold): Use set_edge_probability_and_rescale_others; improve dumps. diff --git a/gcc/predict.cc b/gcc/predict.cc index d65c26f0ab2..1aa4c25eb70 100644 --- a/gcc/predict.cc +++ b/gcc/predict.cc @@ -4421,21 +4421,16 @@ force_edge_cold (edge e, bool impossible) there. */ else if (prob_sum > profile_probability::never ()) { - if (!(e->probability < goal)) - e->probability = goal; - - profile_probability prob_comp = prob_sum / e->probability.invert (); - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Making edge %i->%i %s by redistributing " - "probability to other edges.\n", - e->src->index, e->dest->index, - impossible ? "impossible" : "cold"); - FOR_EACH_EDGE (e2, ei, e->src->succs) - if (e2 != e) - { - e2->probability /= prob_comp; - } + { + fprintf (dump_file, "Making edge %i->%i %s by redistributing " + "probability to other edges. Original probability: ", + e->src->index, e->dest->index, + impossible ? "impossible" : "cold"); + e->probability.dump (dump_file); + fprintf (dump_file, "\n"); + } + set_edge_probability_and_rescale_others (e, goal); if (current_ir_type () != IR_GIMPLE && e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun)) update_br_prob_note (e->src);