Message ID | 20230615095052.13119-1-filip.kastl@gmail.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp510698vqr; Thu, 15 Jun 2023 02:51:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66Qj/dihR8pupHYi6f44Lo6nTygdrTvmwhpYzSGVTBZZq0UPtAsF8sKzX55cyrzm7Jx73g X-Received: by 2002:a17:907:318e:b0:978:6a95:512d with SMTP id xe14-20020a170907318e00b009786a95512dmr16808576ejb.11.1686822707796; Thu, 15 Jun 2023 02:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686822707; cv=none; d=google.com; s=arc-20160816; b=Yl1SUNduKgS+kkjIy3fPGdL4Zd6aoK77/YDTLF9CSVYFRO8k30UXqAXA9HBQVJCClP 8vf9EIa+2pYilS33q56/zKe7d5fciPaHYAxxEmWz2vZgN7lcaRqPnYZ4+0TlkPFx1W6C JsJ7hMG8O2iU09rgFKWFGIE8cyAwTgnaeINmxgrZVyrVCmNeA/jF8LSRGUDrPpV74JHy yee/kwxOuqvQThhnSzzwSEo4FIOApYqa+ZolVScC4JnH7Q7jSeM6Hm0bCmrJ0PzFdC2M m9ioB0uuqv0lA6voalo/oMF8E4lTp1XZmQOunUycCVVnY6iDHXSKHsQLtkkULdPdG7yC 79dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=+tx+GDHjxkxNNP1MnTlzhab/Wg+ce75vyO/TJTlldNI=; b=LGWSvKxNEnopJjwZNK4xizUp8+5aJ4CiVvbZjbnTRmIESpThMurLEnB8z6gHNkC+ox wtMr58LLyddRpX+fnCwNk4oQ78fYDDvhAc+IsBDbxIPYMVBc2r6+yoUrjDxnwo3e6WEE RFZiLU4gT4J7hiPCXVs4/O9ifzHOERxB44IMqoSocxVZHHX1al5JkM1bCpW7Xxhb6zgF oeWP4y6ltclxHvONtjSDFIIQBu4vIx/GYu5/PE1hepByySZ8LTHEKY0w6QWtnGzmqoal m9hXL8A9Bhmvgbb07XDhU7Ijl44fe23rw/qC50dSbXxjT0WJLcuFpctCIqePphSp7mq3 acOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xzRyWuhQ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i18-20020a170906851200b00982be583633si139464ejx.687.2023.06.15.02.51.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 02:51:47 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xzRyWuhQ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AC87438582B7 for <ouuuleilei@gmail.com>; Thu, 15 Jun 2023 09:51:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC87438582B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686822705; bh=+tx+GDHjxkxNNP1MnTlzhab/Wg+ce75vyO/TJTlldNI=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=xzRyWuhQLRCtegnbh12Xoq/MTgf1R8E0nVwXr6vLx4cskpo67Ghz5R5+F/9+POv/E wMn2Kq7pxHED81yIqSBhJol4InaTx5I4DANT5jcawlVDInBIeT7S9b3YAVF+ZN657s CKipLU9mPCmBaYgiAWxgXUS97Q2l7OEtluiswdnk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 9F4413857014 for <gcc-patches@gcc.gnu.org>; Thu, 15 Jun 2023 09:51:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F4413857014 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-982b1a18daeso41100766b.2 for <gcc-patches@gcc.gnu.org>; Thu, 15 Jun 2023 02:51:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686822659; x=1689414659; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+tx+GDHjxkxNNP1MnTlzhab/Wg+ce75vyO/TJTlldNI=; b=NnplBaHzOvM6/ygsS1pgXsoeyY/JuVbltZ9juu22gso1eT9BES4pnvuWm3OVNSVvBp BaE33Bb1AFdA93w0B0m8Vn3OXRZx4l56QMtruSq1AEsuND2N8KMoNEsnAnWP6DlekgtJ eQ8XxJKcg9hGS27Vb+i0hgnmiw0S4S4QViNy1EJMFT7oZNb/L1BHyXsnpcOwsU25wO6X 0eqbkp0WZ/PF85NXcnGPOU/LfiA5jMQB/JcMnul0tq3r9ZniwtEjl6RswEQTO8z0c2YM 4G+NKiecGflh5RmmnsRwmJtWMDprfYW+T/xt6o4egLZDDqhAjQVbZT2rzbRZbe3oKH0U CbAQ== X-Gm-Message-State: AC+VfDzs32Lo6hhwmEZVx5xgnjiDYGdsxou3PXXYYA3AN8R9sUlHraXm pOx3o2h7cJaQh4CuKzxLkoX9+WamByw= X-Received: by 2002:a17:907:d2a:b0:97d:cda7:f0c4 with SMTP id gn42-20020a1709070d2a00b0097dcda7f0c4mr17853224ejc.61.1686822659104; Thu, 15 Jun 2023 02:50:59 -0700 (PDT) Received: from ntb03-Void.cuni.cz (koleje-wifi-0041.koleje.cuni.cz. [78.128.191.41]) by smtp.gmail.com with ESMTPSA id oq19-20020a170906cc9300b00977e0bcff1esm9241695ejb.10.2023.06.15.02.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 02:50:58 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Filip Kastl <filip.kastl@gmail.com> Subject: [PATCH] value-prof.cc: Correct edge prob calculation. Date: Thu, 15 Jun 2023 11:50:52 +0200 Message-Id: <20230615095052.13119-1-filip.kastl@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.8 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Filip Kastl via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Filip Kastl <filip.kastl@gmail.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768761807954247128?= X-GMAIL-MSGID: =?utf-8?q?1768761807954247128?= |
Series |
value-prof.cc: Correct edge prob calculation.
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Filip Kastl
June 15, 2023, 9:50 a.m. UTC
The mod-subtract optimization with ncounts==1 produced incorrect edge
probabilities due to incorrect conditional probability calculation. This
patch fixes the calculation.
gcc/ChangeLog:
* value-prof.cc (gimple_mod_subtract_transform): Correct edge
prob calculation.
Signed-off-by: Filip Kastl <filip.kastl@gmail.com>
---
gcc/value-prof.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
> The mod-subtract optimization with ncounts==1 produced incorrect edge > probabilities due to incorrect conditional probability calculation. This > patch fixes the calculation. > > gcc/ChangeLog: > > * value-prof.cc (gimple_mod_subtract_transform): Correct edge > prob calculation. OK, thanks! Honza
diff --git a/gcc/value-prof.cc b/gcc/value-prof.cc index f40e58ac4f2..580d6dd648d 100644 --- a/gcc/value-prof.cc +++ b/gcc/value-prof.cc @@ -1186,7 +1186,11 @@ gimple_mod_subtract_transform (gimple_stmt_iterator *si) if (all > 0) { prob1 = profile_probability::probability_in_gcov_type (count1, all); - prob2 = profile_probability::probability_in_gcov_type (count2, all); + if (all == count1) + prob2 = profile_probability::even (); + else + prob2 = profile_probability::probability_in_gcov_type (count2, all - + count1); } else {