From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 9AD17387087D for ; Wed, 23 Sep 2020 15:02:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9AD17387087D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mjambor@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Cc" Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A118CAEAB; Wed, 23 Sep 2020 15:03:24 +0000 (UTC) From: Martin Jambor To: Martin =?utf-8?Q?Li=C5=A1ka?= , Jan Hubicka Cc: gcc-patches@gcc.gnu.org Cc: Subject: Re: [PATCH] Fix UBSAN errors in ipa-cp. In-Reply-To: <752e1531-c918-89ee-5807-6c3ccce7bdf5@suse.cz> References: <7115ce43-bf35-c6e4-46b6-56b386e5cb34@suse.cz> <20200923123201.GB41023@kam.mff.cuni.cz> <00825d9b-10a0-b393-d044-ccbc9835c6c8@suse.cz> <752e1531-c918-89ee-5807-6c3ccce7bdf5@suse.cz> User-Agent: Notmuch/0.30 (https://notmuchmail.org) Emacs/26.3 (x86_64-suse-linux-gnu) Date: Wed, 23 Sep 2020 17:02:46 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3038.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, 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: , X-List-Received-Date: Wed, 23 Sep 2020 15:02:50 -0000 Hi, On Wed, Sep 23 2020, Martin Li=C5=A1ka wrote: > There's patch that does that. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin > From ff5f78110684ed9aedde15d19e856b3acf649971 Mon Sep 17 00:00:00 2001 > From: Martin Liska > Date: Wed, 23 Sep 2020 15:10:43 +0200 > Subject: [PATCH] Port IPA CP time and size to sreal > > gcc/ChangeLog: > > * ipa-cp.c (ipcp_lattice::print): Print sreal values > with to_double. > (incorporate_penalties): Change type to sreal. > (good_cloning_opportunity_p): Change args to sreal. > (get_max_overall_size): Work in sreal type. > (estimate_local_effects): Likewise. > (safe_add): Remove. > (value_topo_info::propagate_effects): Work in sreal type. > (ipcp_propagate_stage): Print sreal numbers. > (decide_about_value): Work in sreal type. > --- > gcc/ipa-cp.c | 128 ++++++++++++++++++++++++--------------------------- > 1 file changed, 59 insertions(+), 69 deletions(-) > > diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c > index b3e7d41ea10..9a79b5862f8 100644 > @@ -3224,8 +3226,9 @@ incorporate_penalties (cgraph_node *node, ipa_node_= params *info, > potential new clone in FREQUENCIES. */ >=20=20 > static bool > -good_cloning_opportunity_p (struct cgraph_node *node, int time_benefit, > - int freq_sum, profile_count count_sum, int size_cost) > +good_cloning_opportunity_p (struct cgraph_node *node, sreal time_benefit, > + sreal freq_sum, profile_count count_sum, Is the change of type of freq_sum intentional? Even with this patch, all the callers will keep passing their frequency sums as ints and so the implicit conversion seems a bit misleading. I guess complete transition to sreals would include also switch from using cgraph_edge::frequency to sreal_frequency in get_info_about_necessary_edges and users of struct caller_statistics. I planned to work on conversions to sreals right after resolving various exchange2 issues and I can still do this bit afterwards, but the change in the parameter type looks like you wanted to but eventually did not? Thanks, Martin