From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2093) id 6A23E3858C3A; Thu, 26 Jan 2023 19:12:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A23E3858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674760356; bh=6+0Xx3DfesWogOD8PqbcArWQ1UV0y9pq5SZJqqaiKM8=; h=From:To:Subject:Date:From; b=JNj9btW9rm0Yen5wnFT/Jc4j+ugWSP4k5LXOlOpC+3/RFja0ndefXsupku9xoubjL FQBJL2tU03ZS/FsVUUlmu2Nqk40D6qs4M0jIGHGjE03y9nr6e33Wjl0mH9GBtnnpYh PPD7cTydh2x4LNAjBVMCLxF+SjEkMJHzjib9UDLM= 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-5411] RISC-V: Avoid redundant flow in forward fusion X-Act-Checkin: gcc X-Git-Author: Ju-Zhe Zhong X-Git-Refname: refs/heads/master X-Git-Oldrev: cfe3fbc678d7b69785d2b017d3ff3cd78cd91580 X-Git-Newrev: 00fb7698f0b3ae14d6d472db0f8b64744c84678b Message-Id: <20230126191236.6A23E3858C3A@sourceware.org> Date: Thu, 26 Jan 2023 19:12:36 +0000 (GMT) List-Id: https://gcc.gnu.org/g:00fb7698f0b3ae14d6d472db0f8b64744c84678b commit r13-5411-g00fb7698f0b3ae14d6d472db0f8b64744c84678b Author: Ju-Zhe Zhong Date: Tue Jan 10 06:40:07 2023 +0800 RISC-V: Avoid redundant flow in forward fusion gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pass_vsetvl::forward_demand_fusion): Add pre-check for redundant flow. Diff: --- gcc/config/riscv/riscv-vsetvl.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index f67459ca8ca..9140b1832bf 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -2141,6 +2141,9 @@ pass_vsetvl::forward_demand_fusion (void) if (!prop.valid_or_dirty_p ()) continue; + if (cfg_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)) + continue; + edge e; edge_iterator ei; /* Forward propagate to each successor. */ @@ -2154,6 +2157,11 @@ pass_vsetvl::forward_demand_fusion (void) /* It's quite obvious, we don't need to propagate itself. */ if (e->dest->index == cfg_bb->index) continue; + /* We don't propagate through critical edges. */ + if (e->flags & EDGE_COMPLEX) + continue; + if (e->dest->index == EXIT_BLOCK_PTR_FOR_FN (cfun)->index) + continue; /* If there is nothing to propagate, just skip it. */ if (!local_dem.valid_or_dirty_p ())