From: juzhe.zhong@rivai.ai
To: gcc-patches@gcc.gnu.org
Cc: kito.cheng@gmail.com, palmer@dabbelt.com,
Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Subject: [PATCH] RISC-V: Fix ICE of visiting non-existing block in CFG.
Date: Sat, 24 Dec 2022 11:08:00 +0800 [thread overview]
Message-ID: <20221224030800.221397-1-juzhe.zhong@rivai.ai> (raw)
From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
This patch is to fix issue of visiting non-existing block of CFG.
Since blocks index of CFG in GCC are not always contiguous, we will potentially
visit a gap block which is no existing in the current CFG.
This patch can avoid visiting non existing block in CFG.
I noticed such issue in my internal regression of current testsuite
when I change the X86 server machine. This patch fix it:
17:27:15 job(build_and_test_rv32): Increased FAIL List:
17:27:15 job(build_and_test_rv32): FAIL: gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-46.c
-O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error: Segmentation fault)
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (pass_vsetvl::compute_global_backward_infos): Change to visit CFG.
(pass_vsetvl::prune_expressions): Ditto.
---
gcc/config/riscv/riscv-vsetvl.cc | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index a55b5a1c394..0d66765e09c 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1962,12 +1962,10 @@ pass_vsetvl::compute_global_backward_infos (void)
if (dump_file)
{
fprintf (dump_file, "\n\nDirty blocks list: ");
- for (size_t i = 0; i < m_vector_manager->vector_block_infos.length ();
- i++)
- {
- if (m_vector_manager->vector_block_infos[i].reaching_out.dirty_p ())
- fprintf (dump_file, "%ld ", i);
- }
+ for (const bb_info *bb : crtl->ssa->bbs ())
+ if (m_vector_manager->vector_block_infos[bb->index ()]
+ .reaching_out.dirty_p ())
+ fprintf (dump_file, "%d ", bb->index ());
fprintf (dump_file, "\n\n");
}
}
@@ -1976,15 +1974,16 @@ pass_vsetvl::compute_global_backward_infos (void)
void
pass_vsetvl::prune_expressions (void)
{
- for (size_t i = 0; i < m_vector_manager->vector_block_infos.length (); i++)
+ for (const bb_info *bb : crtl->ssa->bbs ())
{
- if (m_vector_manager->vector_block_infos[i].local_dem.valid_or_dirty_p ())
+ if (m_vector_manager->vector_block_infos[bb->index ()]
+ .local_dem.valid_or_dirty_p ())
m_vector_manager->create_expr (
- m_vector_manager->vector_block_infos[i].local_dem);
- if (m_vector_manager->vector_block_infos[i]
+ m_vector_manager->vector_block_infos[bb->index ()].local_dem);
+ if (m_vector_manager->vector_block_infos[bb->index ()]
.reaching_out.valid_or_dirty_p ())
m_vector_manager->create_expr (
- m_vector_manager->vector_block_infos[i].reaching_out);
+ m_vector_manager->vector_block_infos[bb->index ()].reaching_out);
}
if (dump_file)
--
2.36.3
next reply other threads:[~2022-12-24 3:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-24 3:08 juzhe.zhong [this message]
2022-12-27 21:47 ` Jeff Law
[not found] ` <91200E8AE78D17FA+15C0DC8B-584B-48FB-B92F-6932C4CCEB51@rivai.ai>
2022-12-28 0:06 ` Jeff Law
2022-12-28 0:24 ` 钟居哲
2022-12-28 1:11 ` Jeff Law
2022-12-28 1:34 ` Kito Cheng
2022-12-28 5:20 ` 钟居哲
2022-12-28 11:47 ` Richard Sandiford
2022-12-28 11:57 ` 钟居哲
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=20221224030800.221397-1-juzhe.zhong@rivai.ai \
--to=juzhe.zhong@rivai.ai \
--cc=gcc-patches@gcc.gnu.org \
--cc=kito.cheng@gmail.com \
--cc=palmer@dabbelt.com \
/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: link
Be 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).