From patchwork Tue Jan 9 01:24:53 2024 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: 1884101 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=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T8Csy68bVz1yPf for ; Tue, 9 Jan 2024 12:25:26 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0CF03858C29 for ; Tue, 9 Jan 2024 01:25:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) by sourceware.org (Postfix) with ESMTPS id 374613858D38 for ; Tue, 9 Jan 2024 01:25:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 374613858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 374613858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=54.204.34.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704763505; cv=none; b=EiLlNxPS3GGtWWMGOGrKukv0aKTgusjJEg/3i8643N2bZBm1Ow6ZHlXRjrEUTrsZEtFC896MTMDm98oZjQsUMxQ0/Gh999kENKuNdiW/ze+6alSFYAU5RdCiQo6NNpSvM4l1Xh7aFjElTRGvYz/EBGw7mD/VjKlkrloUaWya7i8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704763505; c=relaxed/simple; bh=2wuyda8AUJcvEbiw5fH9gDecQPt3jX0/AGQH/770Qlw=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=XdcA0rh7XL2rnfE2FaLkf/s/++qt87BLEHCGKSU54OMPt99e96a6L3a4MJ4EjQvxCe+Iikq06bAesj0XDlccGaaDHM8+MF26DC9sDfGp/cIOTsfbNXcY6l4Ks/58ZRZenHxkQIfuvVi+GDD4EHJQIrj9A6M+f6B3xDsWMkJvqac= ARC-Authentication-Results: i=1; server2.sourceware.org X-QQ-mid: bizesmtp88t1704763495t5vap94x Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 09 Jan 2024 09:24:54 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: mVW5qUmWNiuVUp9dK0WDNH+WjEsm3WpHfIYPE6bKe3ivc2xwnZsy1mII/donQ L99WmTdKCY7s5knVLLkGFAqfhPBSeiOc4g5AlLVXWYYIGep78ceDJyBPkLPwmAY+GPfgeZ7 x14ohd+kkgzH4vKJX4gSmow4UQTSuDQmtxarl+Q9p1QTYwxLggZdILxaw2ouji7iuPXAq4X 5n6AG2K3/NuIegEdJQW1NSVRtP5A8/8IPp7V1UWMfAANcn9B66l3ugdZJre5ug3959DZgJd hCKpEcgjXcwNCKutu1bxCtl7/eAtAjKLcBcoWPZeYmzdULt9rNSCJnSKqFJelGB0VsyuUVg wvJw8MRt0VyvnD9daCDQX53G+CwP4J0AtTFihwKVWPelWin3ruA7+tgJ3NMBg== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 8764608830665861480 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, Juzhe-Zhong Subject: [PATCH] RISC-V: Fix loop invariant check Date: Tue, 9 Jan 2024 09:24:53 +0800 Message-Id: <20240109012453.675353-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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.30 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 As Robin suggested, remove gimple_uid check which is sufficient for our need. Tested on both RV32/RV64 no regression, ok for trunk ? gcc/ChangeLog: * config/riscv/riscv-vector-costs.cc (loop_invariant_op_p): Fix loop invariant check. --- gcc/config/riscv/riscv-vector-costs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/riscv/riscv-vector-costs.cc b/gcc/config/riscv/riscv-vector-costs.cc index 3bae581d6fd..f4a1a789f23 100644 --- a/gcc/config/riscv/riscv-vector-costs.cc +++ b/gcc/config/riscv/riscv-vector-costs.cc @@ -241,7 +241,7 @@ loop_invariant_op_p (class loop *loop, if (SSA_NAME_IS_DEFAULT_DEF (op) || !flow_bb_inside_loop_p (loop, gimple_bb (SSA_NAME_DEF_STMT (op)))) return true; - return gimple_uid (SSA_NAME_DEF_STMT (op)) & 1; + return false; } /* Return true if the variable should be counted into liveness. */