From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2093) id E3FA53858D28; Sun, 5 Mar 2023 17:23:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3FA53858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678037038; bh=SiYb2ubRGbt/dbrJoO5+YgHqnfGhUMclpXgU9SdiGNU=; h=From:To:Subject:Date:From; b=JxGLT3aCCq4iqRWhcLUXUmpBfSJhYa3E9cM8HF5Yz91eqW5koaphM4HAoCRLIOh/1 ko4BSKZxTu1iJ7IunCpUbWhltjX4t5YMbM3oJLA6wCuRe932ZtUjoBkJcS01V88Tg8 w7aZqLGzZisN/qK/g3dcYNZTMPU10B121nnP+xXY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Kito Cheng To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-6495] RISC-V: Fix ICE for avl_single-86/avl_single-88/avl_single-90 X-Act-Checkin: gcc X-Git-Author: Ju-Zhe Zhong X-Git-Refname: refs/heads/master X-Git-Oldrev: 2554d90c6c2cf80559b918d387944da35fc6aa23 X-Git-Newrev: 44c918b50af64d1c0f27067b2671e1a4f744841b Message-Id: <20230305172358.E3FA53858D28@sourceware.org> Date: Sun, 5 Mar 2023 17:23:58 +0000 (GMT) List-Id: https://gcc.gnu.org/g:44c918b50af64d1c0f27067b2671e1a4f744841b commit r13-6495-g44c918b50af64d1c0f27067b2671e1a4f744841b Author: Ju-Zhe Zhong Date: Sun Mar 5 18:24:30 2023 +0800 RISC-V: Fix ICE for avl_single-86/avl_single-88/avl_single-90 If prop is demand of vsetvl instruction and reaching doesn't demand AVL. We don't backward propagate since vsetvl instruction has no side effects. FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-86.c -Og -g (internal compiler error: Segmentation fault) FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-86.c -Og -g (test for excess errors) FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-88.c -Og -g (internal compiler error: Segmentation fault) FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-88.c -Og -g (test for excess errors) FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-90.c -Og -g (internal compiler error: Segmentation fault) FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-90.c -Og -g (test for excess errors) gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (reg_available_p): Fix bug. (pass_vsetvl::backward_demand_fusion): Ditto. Diff: --- gcc/config/riscv/riscv-vsetvl.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 9e25102a4f2..73f36a70331 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1528,7 +1528,7 @@ static bool reg_available_p (const bb_info *bb, const vector_insn_info &info) { if (!info.get_avl_source ()) - return true; + return false; insn_info *insn = info.get_avl_source ()->insn (); if (insn->bb () == bb) return before_p (insn, info.get_insn ()); @@ -3040,6 +3040,12 @@ pass_vsetvl::backward_demand_fusion (void) continue; if (e->src->index == ENTRY_BLOCK_PTR_FOR_FN (cfun)->index) continue; + /* If prop is demand of vsetvl instruction and reaching doesn't demand + AVL. We don't backward propagate since vsetvl instruction has no + side effects. */ + if (vsetvl_insn_p (prop.get_insn ()->rtl ()) + && propagate_avl_across_demands_p (prop, block_info.reaching_out)) + continue; if (block_info.reaching_out.unknown_p ()) continue;