From patchwork Fri Jun 24 08:13:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 55369 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6C2F7384D158 for ; Fri, 24 Jun 2022 08:14:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id BD10C385416C for ; Fri, 24 Jun 2022 08:13:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD10C385416C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3C0E81F8BE; Fri, 24 Jun 2022 08:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1656058421; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FWUQR9n6WtDej7vUfjunMZrxtwf0uJBs0mN2+er6Dbo=; b=yZzcCTasOrH/GnXDZfS8921YHAe5O+kof4jAwJFC2oN5yDRMX56RUDCcfJz57knJO2uJzZ kqfUSPRG/6xEbD5xCIzJTuKnzrB6UuLLZErL3sRjcAsxmX2fo+YeutCETngGYzpkfP0ErD DwDihPg9H754qqPOTe6nwN6wQEylW0E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1656058421; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FWUQR9n6WtDej7vUfjunMZrxtwf0uJBs0mN2+er6Dbo=; b=UBqP5mA8LWZSf44aN+vndOgR0G6oPlLzMikvpVqLzTvMfXhb95BOqCkOmTBojm7n7I/vdU EmhE70BePlTQ3JBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 262F413ACA; Fri, 24 Jun 2022 08:13:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DfdeCDVytWLnYgAAMHmgww (envelope-from ); Fri, 24 Jun 2022 08:13:41 +0000 Message-ID: Date: Fri, 24 Jun 2022 10:13:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] profile-count: fix /= and *= operators To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: , Cc: Jan Hubicka Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi. As noticed in the PR, I wrongly introduced /= and *= operators. Problem was that these operators need to modify *this object. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin PR middle-end/106059 gcc/ChangeLog: * profile-count.h: *= and /= operators need to modify this object. --- gcc/profile-count.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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); } - profile_probability operator*= (int64_t den) const + profile_probability operator*= (int64_t num) { - return *this * den; + *this = apply_scale (num, 1); + return *this; } profile_probability operator/ (int64_t den) const @@ -615,9 +616,10 @@ public: return apply_scale (1, den); } - profile_probability operator/= (int64_t den) const + profile_probability operator/= (int64_t den) { - return *this / den; + *this = apply_scale (1, den); + return *this; } /* Get the value of the count. */ @@ -1017,9 +1019,10 @@ public: return apply_scale (num, 1); } - profile_count operator*= (int64_t den) const + profile_count operator*= (int64_t num) { - return *this * den; + *this = apply_scale (num, 1); + return *this; } profile_count operator/ (int64_t den) const @@ -1027,9 +1030,10 @@ public: return apply_scale (1, den); } - profile_count operator/= (int64_t den) const + profile_count operator/= (int64_t den) { - return *this / den; + *this = apply_scale (1, den); + return *this; } /* Return true when value is not zero and can be used for scaling.