From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 9AC023858C83 for ; Mon, 26 Sep 2022 07:51:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9AC023858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52a.google.com with SMTP id b35so7896072edf.0 for ; Mon, 26 Sep 2022 00:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=Y9woNmji94eETBb913V0x4AtJ0SqNuCVxMmitXBNDhs=; b=IztzWAI6gQG9hLg9mF+AQSUusWxbSfNtMMSW9TI17CT02m422SqZwEEwBMJnnFrYRu moZ5eMwF7GyNJDPWKNGqj2EjDqbhSTYlyWIKUJ7IA7ns+vTVVTAk9fuskFDf3akjzOB/ 9GYSrtZg8BXWa2r/Vq5eWg82CowNNo0BHQV1utCYD23fEp9F9YNKhYdOuhWA78S7lF0E xL7T9NELpJ5q7IAjLakfkE1DqK6GwvFZ8U7n0DViF4BK+rEoJKLM2GJS4MnZxS2LZo9B wm5Hhm7pI8Et22T8YS4jzn3n4I9fGTP5r4gFm+2odUyaeWaYDo0+hwpXfVTBXWa98uJe L70g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=Y9woNmji94eETBb913V0x4AtJ0SqNuCVxMmitXBNDhs=; b=CbuBM0ZrzY8mwmxNAI5XiYBXWlRvvsyLQpI1iZ2GGWS4sC55rz2ZbY8pDCQa1Oz0v3 k3SBJuG8ztCiPVWX3AlMDythO7oK+pKmCPzbBZSaGDlHRanzy9HVfwtq3aX2Uv6C4Rdv R6C8KxYHw898F/qIda2O5tVomkcHHtx57fTXtf7tkFcgJ2vlvrbJFJnpQI+Nartxq/eu 5LduHSItnuIyD4FTDPAZs23dPosuncICGI9GEtv8bWei3Jjug30QvABWFkk02asAJyG7 oFXvNTBR147/Ag97ljdJ0rzHPhelNiVKIMIZp4jx1yGFmJJ5/9rMvmEuHsGSvMi7SYSN XFBQ== X-Gm-Message-State: ACrzQf1+qp5DWcECAVveSmgEE7eBeamZmQ0+fZ3s6Z5H+4WjCvUmQIvk HHBxVeYBWjewOlLab9BYxnmp/bWDpYKft0iz5O4= X-Google-Smtp-Source: AMsMyM76DLizDlYuHLHh+1lG5DCPRFhrPwiS1LjI89dhd1zNgsDL68ha2XdFTkKgTHbS5yjJBQ4cHcNSPBHYUuPq3nU= X-Received: by 2002:a05:6402:3596:b0:450:c4d9:a04b with SMTP id y22-20020a056402359600b00450c4d9a04bmr21204552edc.218.1664178679442; Mon, 26 Sep 2022 00:51:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 26 Sep 2022 09:51:04 +0200 Message-ID: Subject: Re: [PATCH] Fix profile count comparison. To: Eugene Rozenfeld Cc: "gcc-patches@gcc.gnu.org" , Jan Hubicka Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: On Fri, Sep 23, 2022 at 8:53 PM Eugene Rozenfeld via Gcc-patches wrote: > > The comparison was incorrect when the counts weren't PRECISE. > For example, crossmodule-indir-call-topn-1.c was failing > with AutoFDO: when count_sum is 0 with quality AFDO, > count_sum > profile_count::zero() evaluates to true. Taking that > branch then leads to an assert in the call to to_sreal(). > > Tested on x86_64-pc-linux-gnu. OK > gcc/ChangeLog: > > * ipa-cp.cc (good_cloning_opportunity_p): Fix profile count comparison. > --- > gcc/ipa-cp.cc | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc > index 543a9334e2c..66bba71c068 100644 > --- a/gcc/ipa-cp.cc > +++ b/gcc/ipa-cp.cc > @@ -3338,9 +3338,9 @@ good_cloning_opportunity_p (struct cgraph_node *node, sreal time_benefit, > > ipa_node_params *info = ipa_node_params_sum->get (node); > int eval_threshold = opt_for_fn (node->decl, param_ipa_cp_eval_threshold); > - if (count_sum > profile_count::zero ()) > + if (count_sum.nonzero_p ()) > { > - gcc_assert (base_count > profile_count::zero ()); > + gcc_assert (base_count.nonzero_p ()); > sreal factor = count_sum.probability_in (base_count).to_sreal (); > sreal evaluation = (time_benefit * factor) / size_cost; > evaluation = incorporate_penalties (node, info, evaluation); > -- > 2.25.1