From patchwork Thu Nov 2 11:30:23 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: 1858409 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 4SLhXY5wP5z1yQ4 for ; Thu, 2 Nov 2023 22:31:25 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64231385773F for ; Thu, 2 Nov 2023 11:31:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgsg1.qq.com (smtpbgsg1.qq.com [54.254.200.92]) by sourceware.org (Postfix) with ESMTPS id 886273861886 for ; Thu, 2 Nov 2023 11:30:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 886273861886 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 886273861886 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=54.254.200.92 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698924642; cv=none; b=IDJm4UcGmoV7BOC5ySulE18t4Vn77skOy0tigwn32RjWyHLOF33Q/56y97fyfglgjzp5azMyTT99yNdGUShYx/jafuWRzIy/1Sw3Cw76Qd019cZ1TeKLVFKw9g8RwZ1KncUpCk748VqwWo68Q4377G/LGUfImc7mCWF9yDe3iEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698924642; c=relaxed/simple; bh=eG7zQ7oAAMgFsW4mRUF9oVVIiUmky4zkAgnRHyKUtig=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=pZBVObo0LvC6hNXRgg5YsNIKOUog2l2H2o0z/hbH19SJROk9CSXPMBTawI0T2Bx1rQI1Msuq83dLvoXCi9aLOZIbKq1BdGTc8HnJnH7mp1MB7xzxyT2v6PwzmeLtPLfdhlZ48wHK+CHx21qjB4SGeuC2EDZuUIQK4bFdzw7F94Y= ARC-Authentication-Results: i=1; server2.sourceware.org X-QQ-mid: bizesmtp84t1698924625t09hbi67 Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 02 Nov 2023 19:30:24 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: ILHsT53NKPjml5l82idFTU/z4kcvXe+RJPt0VY8ypR6nhvcddebArj2GUAEnR zV8xvTHUgGEL5niC3p7ZTCioj0ne2U0GNy6InYJFiwkJiLcx+bSX8j94WfOtnRJPDP7tMbA lShSl9SiKmWgb5T8Y9vwtd7Bj8JwDcjcL7kL5h/0G/nc8Q2csWA51BV6RxFl54Q//KPmdAK /5PWmSkkuHyxc9Fo1kMk7RsPJawFVdn2IQsN39zb/INLMJz/Aw8+z1riyqEoroo+UEtY+EG D7KDqOlnPZtRczzRY0a6O2/+/UBcmNjYgk8ZUqQFaUGWV7JkvvtDxnhAejx60X1h74h1y8M bcLp3yjNaPAZPLgrgC5yFbYceo8cmv5NoXaVZW9L5DaHyuXPMIbp9zx6PvI9WdeO966IJEG Eb/KqA3i+6wLFqhPl0Q+Uw== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 6004031123896665420 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 bug of AVL propagation PASS Date: Thu, 2 Nov 2023 19:30:23 +0800 Message-Id: <20231102113023.2225297-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.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 A run FAIL suddenly shows up today to me: FAIL: gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c execution test that I didn't have before. After investigation, I realize that there is a bug in AVL propagtion PASS. gcc/ChangeLog: * config/riscv/riscv-avlprop.cc (pass_avlprop::get_vlmax_ta_preferred_avl): Don't allow non-real insn AVL propation. --- gcc/config/riscv/riscv-avlprop.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/config/riscv/riscv-avlprop.cc b/gcc/config/riscv/riscv-avlprop.cc index bec1e3c715a..1dfaa8742da 100644 --- a/gcc/config/riscv/riscv-avlprop.cc +++ b/gcc/config/riscv/riscv-avlprop.cc @@ -308,6 +308,13 @@ pass_avlprop::get_vlmax_ta_preferred_avl (insn_info *insn) const def_info *def2 = dl.prev_def (use_insn); if (!def1 || !def2 || def1 != def2) return NULL_RTX; + /* For vectorized codes, we always use SELECT_VL/MIN_EXPR to + calculate the loop len at the header of the loop. + We only allow AVL propagation for real instruction for now. + TODO: We may enhance it for intrinsic codes if it is necessary. + */ + if (!def1->insn ()->is_real ()) + return NULL_RTX; /* FIXME: We only all AVL propation within a block which should be totally enough for vectorized codes.