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: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 160838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp283195vqu; Thu, 2 Nov 2023 04:32:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWp8dY5ZnA4FWTdOUuI3T2va6wyLyLZ163lsvTrKtTIBVPYiqnr5Ip+p7d7TuxJNJjy+Ku X-Received: by 2002:a05:6808:102:b0:3ae:5aab:a6f9 with SMTP id b2-20020a056808010200b003ae5aaba6f9mr16994777oie.46.1698924735497; Thu, 02 Nov 2023 04:32:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698924735; cv=pass; d=google.com; s=arc-20160816; b=FG31KJIzNUaQr/WhVshsKaqIBYRzpmjAr0qMQYipJ0YDPpCDLMP45blG4jIPOkjRyR WABkI7NBKi6yP/CDrFE8oo64lDZxBdIkIdxmwD71e+zA1oBsp6ZRBVlpTc9WV7sWfMH7 gfV0Y16R2AycwqzpMx+6Vq/XEwdD520RfbreP05HVRJHELSjEmwUGT/ghfmYCyL5YxTY q5LwSm8+STyLxwn90eqJXGBNB3q81ro0Ce/UXxz4Ph2/4WxIsVgFiEnZHBXuBHE7ERve hvP6+cP1h4EyoiiqZqlJtghFH9tw9jRQbyCd0X2YnnO13spjWLTQyjMGi0//Ew06Y8/W UICQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:arc-filter:dmarc-filter:delivered-to; bh=iXe+SXonVkgI0kjYwV54X25Kq9VcA2Hi0KfqUJmAids=; fh=12MRPJmZ1mgDpHqWoogMKqnaGRGM2b7lcuJroqfjJiw=; b=IgTH9XAZBSLU5xrsPuZnKMXNhZqxNDUD+IS0bc6Ayzmmd0CoDSoR/kcfJ4YNOlHH+7 UauOhXVfpGpbC1lPZJ/BbIXhVBJTm30tbTdHukpV7uCk9W0YAgnbdUYfLQj5fwFJ3zl0 6de//vzG33gc7YDOIngFugmzCuALOitnDTFBEfSznK3L4qUv3JFSDAE91K/Ya9zqLaSH Z8/3flR+ptkLd2O4+qwVgVbSbvXzHVZRJlU8nWzWL3UTpx9u9Dih24XCFgRdofRDWcD4 YpabgQKHzedwqzX/ifRHN9UaJ/t2MGWQ3YRILvmGgIGdVAg82iHb3s9s2s/vfviCvm4T PZ4w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x19-20020a05620a099300b007709df4a576si4004075qkx.711.2023.11.02.04.32.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 04:32:15 -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; arc=pass (i=1); 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C9BA38313AF for ; Thu, 2 Nov 2023 11:31:35 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781451703038696219 X-GMAIL-MSGID: 1781451703038696219 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.