From patchwork Mon Jan 9 23:17:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6ZKf5bGF5ZOy?= X-Patchwork-Id: 1723754 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NrVGd3gtFz23fc for ; Tue, 10 Jan 2023 10:17:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 362413858414 for ; Mon, 9 Jan 2023 23:17:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by sourceware.org (Postfix) with ESMTPS id B145F3858CDA for ; Mon, 9 Jan 2023 23:17:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B145F3858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp65t1673306242t2cg1kkq Received: from server1.localdomain ( [58.60.1.22]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 10 Jan 2023 07:17:21 +0800 (CST) X-QQ-SSF: 01400000002000E0L000B00A0000000 X-QQ-FEAT: rZJGTgY0+YOmqgMjemrY57wMYlFRB1xZcNE+LzzNIJdmeQVI2YuntYrPN1NVP 6ZvH/2BIe773Ax0YJjBMT4YVKyEtMPkZBT1cK1Y4P694eutzzjYqLbUuxqIZCIok1jqm0fN EfUaI52pbWp+BnE56HXj08/WpO0HOcIUrMm4OstHj39Zk5V5APGECUIl/0Qdv8j+xLv/Zh2 IUJ0yiF+t7G1Q7/crrQo/n/hTrDj3/pnNQUvYbaNPACit9BCQRJiSU4pAfn/sgiCpC8pN++ EY3/NAiKAGTKckgQA5abCXUA71UpaLcvEIRpVdKfhgZzf6sWudB4P/JTWBSOZcA5nmcgwSX uVZjEZbcSA5I1fw1x2kk4LNjQvkFH1zWWJUInDcvFdJNvhW2y2LnOnD/BMisw== X-QQ-GoodBg: 2 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, Ju-Zhe Zhong Subject: [PATCH] RISC-V: Add probability model of each block to prevent endless loop of Phase 3 Date: Tue, 10 Jan 2023 07:17:20 +0800 Message-Id: <20230109231720.155773-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvr:qybglogicsvr7 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Ju-Zhe Zhong Notice that the PASS is just simpily pick the probability >= 50% to do the backward fusion which will create endless loop on Phase 3. Adding this probability to fix this bug. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_infos_manager::vector_infos_manager): Add probability. (vector_infos_manager::dump): Ditto. (pass_vsetvl::compute_probabilities): Ditto. * config/riscv/riscv-vsetvl.h (struct vector_block_info): Ditto. --- gcc/config/riscv/riscv-vsetvl.cc | 39 ++++++++++++++++++++++++++++++++ gcc/config/riscv/riscv-vsetvl.h | 3 +++ 2 files changed, 42 insertions(+) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 0f12d4ddb23..7d8c3a32aaa 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1465,6 +1465,7 @@ vector_infos_manager::vector_infos_manager () vector_block_infos[bb->index ()].reaching_out = vector_insn_info (); for (insn_info *insn : bb->real_insns ()) vector_insn_infos[insn->uid ()].parse_insn (insn); + vector_block_infos[bb->index ()].probability = profile_probability (); } } } @@ -1642,6 +1643,8 @@ vector_infos_manager::dump (FILE *file) const } fprintf (file, "