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 447233858C66 for ; Wed, 26 Jul 2023 07:01:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 447233858C66 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 939042829BB; Wed, 26 Jul 2023 09:01:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1690354881; 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=cDnDO4OOOuAqGMAX2z2LmYXCZysj9y6EPmHhihxdGRs=; b=TW+8QNrW4sYyFiCqRAlP5PTzyZAZr3xEK+MVGgNrKGlQ4hkTxcMt4B5O/8l9Ka9EzQ5Z7r B4mUBo5lbDBoYP/OizoNaNm3Z8Z4b18VBNPHJZ/+SSvbWt8yxy+auqhLHI+GwdvXV/ZlU6 8ZJuxjlydGK0Cv5tI2+VT+AWPHmqlMw= Date: Wed, 26 Jul 2023 09:01:21 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix profile_count::to_sreal_scale Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 List-Id: Hi, this patch makes profile_count::to_sreal_scale consider the scale unknown when in is 0. This fixes the case where loop has 0 executions in profile feedback and thus we can't determine its trip count. Bootstrapped/regtested x86_64-linux, comitted. Honza gcc/ChangeLog: * profile-count.cc (profile_count::to_sreal_scale): Value is not know if we divide by zero. diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc index 2c07ebc5942..eaf0f0d787e 100644 --- a/gcc/profile-count.cc +++ b/gcc/profile-count.cc @@ -345,7 +345,7 @@ profile_count::to_sreal_scale (profile_count in, bool *known) const return 1; } if (known) - *known = true; + *known = in.m_val != 0; if (*this == in) return 1; gcc_checking_assert (compatible_p (in));