public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Lehua Ding <lhtin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8448] RISC-V: Refine some codes of VSETVL PASS [NFC] Date: Fri, 26 Jan 2024 08:34:25 +0000 (GMT) [thread overview] Message-ID: <20240126083426.29A213858C74@sourceware.org> (raw) https://gcc.gnu.org/g:bf23a62ee08fdc114a517dc4af148f15fa5d6545 commit r14-8448-gbf23a62ee08fdc114a517dc4af148f15fa5d6545 Author: Juzhe-Zhong <juzhe.zhong@rivai.ai> Date: Fri Jan 26 16:31:09 2024 +0800 RISC-V: Refine some codes of VSETVL PASS [NFC] gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pre_vsetvl::earliest_fuse_vsetvl_info): Refine some codes. (pre_vsetvl::emit_vsetvl): Ditto. Diff: --- gcc/config/riscv/riscv-vsetvl.cc | 69 ++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 1a398f025963..d7b40a5c813c 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -2930,28 +2930,19 @@ pre_vsetvl::earliest_fuse_vsetvl_info (int iter) EXECUTE_IF_SET_IN_BITMAP (e, 0, expr_index, sbi) { vsetvl_info &curr_info = *m_exprs[expr_index]; - if (!curr_info.valid_p ()) - continue; - edge eg = INDEX_EDGE (m_edges, ed); - if (eg->probability == profile_probability::never ()) - continue; - if (eg->src == ENTRY_BLOCK_PTR_FOR_FN (cfun) - || eg->dest == EXIT_BLOCK_PTR_FOR_FN (cfun)) - continue; - - /* When multiple set bits in earliest edge, such edge may - have infinite loop in preds or succs or multiple conflict - vsetvl expression which make such edge is unrelated. We - don't perform fusion for such situation. */ - if (bitmap_count_bits (e) != 1) - continue; - vsetvl_block_info &src_block_info = get_block_info (eg->src); vsetvl_block_info &dest_block_info = get_block_info (eg->dest); - if (src_block_info.probability - == profile_probability::uninitialized ()) + if (!curr_info.valid_p () + || eg->probability == profile_probability::never () + || src_block_info.probability + == profile_probability::uninitialized () + /* When multiple set bits in earliest edge, such edge may + have infinite loop in preds or succs or multiple conflict + vsetvl expression which make such edge is unrelated. We + don't perform fusion for such situation. */ + || bitmap_count_bits (e) != 1) continue; if (src_block_info.empty_p ()) @@ -3058,29 +3049,27 @@ pre_vsetvl::earliest_fuse_vsetvl_info (int iter) { vsetvl_info &prev_info = src_block_info.get_exit_info (); if (!prev_info.valid_p () - || m_dem.available_p (prev_info, curr_info)) + || m_dem.available_p (prev_info, curr_info) + || !m_dem.compatible_p (prev_info, curr_info)) continue; - if (m_dem.compatible_p (prev_info, curr_info)) + if (dump_file && (dump_flags & TDF_DETAILS)) { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, " Fuse curr info since prev info " - "compatible with it:\n"); - fprintf (dump_file, " prev_info: "); - prev_info.dump (dump_file, " "); - fprintf (dump_file, " curr_info: "); - curr_info.dump (dump_file, " "); - } - m_dem.merge (prev_info, curr_info); - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, " prev_info after fused: "); - prev_info.dump (dump_file, " "); - fprintf (dump_file, "\n"); - } - changed = true; + fprintf (dump_file, " Fuse curr info since prev info " + "compatible with it:\n"); + fprintf (dump_file, " prev_info: "); + prev_info.dump (dump_file, " "); + fprintf (dump_file, " curr_info: "); + curr_info.dump (dump_file, " "); + } + m_dem.merge (prev_info, curr_info); + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, " prev_info after fused: "); + prev_info.dump (dump_file, " "); + fprintf (dump_file, "\n"); } + changed = true; } } } @@ -3344,15 +3333,11 @@ pre_vsetvl::emit_vsetvl () { edge eg = INDEX_EDGE (m_edges, ed); sbitmap i = m_insert[ed]; - if (bitmap_count_bits (i) < 1) - continue; - - if (bitmap_count_bits (i) > 1) + if (bitmap_count_bits (i) != 1) /* For code with infinite loop (e.g. pr61634.c), The data flow is completely wrong. */ continue; - gcc_assert (bitmap_count_bits (i) == 1); unsigned expr_index = bitmap_first_set_bit (i); const vsetvl_info &info = *m_exprs[expr_index]; gcc_assert (info.valid_p ());
reply other threads:[~2024-01-26 8:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240126083426.29A213858C74@sourceware.org \ --to=lhtin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).