From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 9E5D6385AE41 for ; Fri, 24 Jun 2022 08:38:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E5D6385AE41 Received: by mail-wr1-x435.google.com with SMTP id m1so2169381wrb.2 for ; Fri, 24 Jun 2022 01:38:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=tVeKqakgviD8FLpoiz+LDc+QJQl0GSI4CZ4vMTyBuM0=; b=xqXAQr5Q8WZkjrufk2ZAB/JLs+cLIiJwu6ngLztk78GoX7PHHt/Q+U3CyiS10qB9Rc DPwQ64Arqu8u8foTz+vJrtuejvlp1WvcN1o3Fi1CFDXq+fxhdHubh/zyJyH1IuwiXj6s H/o/QfvZv0r5i8tMCOgB58sMxdE7XWa+fQXGXY1m/7NZ/uhRvBTn5befVyIojJ0+nlUg bqGUXFnHeV9fN2AJIlHCzWSVIRqe7RWzn4vKZPElExyBaD+9ITbXsZhfXf1QB0e3b5VQ TPOG9b6tOtQiQC8ErPH3oW2yGAPsGkxAHhmu2aW8P9FRjyvhqIlVuQHz6O1/W/WF23rk tXAw== X-Gm-Message-State: AJIora9miOPrhzSsD6PePj34fp8A6iQ21ILKUPyNc5+96FtpWO/uByhy jBPDy7w4WA6Dwu74JUcSAEEkflukqlSxVw== X-Google-Smtp-Source: AGRyM1v/W3GDDMnD+b0ijd86TO+Fv84qDLDWHS+HrAIgHc1L7Bsi1zSf1Yx6Ndgi5Qwn0KyZnRMe2g== X-Received: by 2002:a5d:534e:0:b0:21b:adf3:dc19 with SMTP id t14-20020a5d534e000000b0021badf3dc19mr4610747wrv.543.1656059890081; Fri, 24 Jun 2022 01:38:10 -0700 (PDT) Received: from smtpclient.apple ([2a02:3038:10:55be:c892:f305:5fb7:c6a8]) by smtp.gmail.com with ESMTPSA id l14-20020a05600c4f0e00b003942a244f40sm6382091wmq.25.2022.06.24.01.38.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jun 2022 01:38:09 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] profile-count: fix /= and *= operators Date: Fri, 24 Jun 2022 10:38:09 +0200 Message-Id: References: Cc: gcc-patches@gcc.gnu.org, Jan Hubicka In-Reply-To: To: =?utf-8?Q?Martin_Li=C5=A1ka?= X-Mailer: iPhone Mail (19F77) X-Spam-Status: No, score=-10.4 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, 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 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: Fri, 24 Jun 2022 08:38:13 -0000 > Am 24.06.2022 um 10:14 schrieb Martin Li=C5=A1ka : >=20 > =EF=BB=BFHi. >=20 > As noticed in the PR, I wrongly introduced /=3D and *=3D operators. > Problem was that these operators need to modify *this object. >=20 > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >=20 > Ready to be installed? Ok > Thanks, > Martin >=20 > PR middle-end/106059 >=20 > gcc/ChangeLog: >=20 > * profile-count.h: *=3D and /=3D operators need to modify this > object. > --- > gcc/profile-count.h | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) >=20 > diff --git a/gcc/profile-count.h b/gcc/profile-count.h > index be6e2d57cf7..141a8827001 100644 > --- a/gcc/profile-count.h > +++ b/gcc/profile-count.h > @@ -605,9 +605,10 @@ public: > return apply_scale (num, 1); > } >=20 > - profile_probability operator*=3D (int64_t den) const > + profile_probability operator*=3D (int64_t num) > { > - return *this * den; > + *this =3D apply_scale (num, 1); > + return *this; > } >=20 > profile_probability operator/ (int64_t den) const > @@ -615,9 +616,10 @@ public: > return apply_scale (1, den); > } >=20 > - profile_probability operator/=3D (int64_t den) const > + profile_probability operator/=3D (int64_t den) > { > - return *this / den; > + *this =3D apply_scale (1, den); > + return *this; > } >=20 > /* Get the value of the count. */ > @@ -1017,9 +1019,10 @@ public: > return apply_scale (num, 1); > } >=20 > - profile_count operator*=3D (int64_t den) const > + profile_count operator*=3D (int64_t num) > { > - return *this * den; > + *this =3D apply_scale (num, 1); > + return *this; > } >=20 > profile_count operator/ (int64_t den) const > @@ -1027,9 +1030,10 @@ public: > return apply_scale (1, den); > } >=20 > - profile_count operator/=3D (int64_t den) const > + profile_count operator/=3D (int64_t den) > { > - return *this / den; > + *this =3D apply_scale (1, den); > + return *this; > } >=20 > /* Return true when value is not zero and can be used for scaling.=20 > --=20 > 2.36.1 >=20