https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112447

--- Comment #17 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
The incorrect elimination happens on pre_global_vsetvl_info

You can try simple hack like this:

diff --git a/gcc/config/riscv/riscv-vsetvl.cc
b/gcc/config/riscv/riscv-vsetvl.cc
index 8466b5d019e..65dcf931808 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -3135,6 +3135,8 @@ pre_vsetvl::pre_global_vsetvl_info ()
   for (const bb_info *bb : crtl->ssa->bbs ())
     {
       sbitmap d = m_del[bb->index ()];
+      if (bb->index () == 113 || bb->index () == 54)
+        continue;
       if (bitmap_count_bits (d) == 0)
        continue;


FAIL will be fixed.

So, the idea is that we should investigate why LCM calculation return

m_del to be true on BB 54 and BB 113.

The calculation is done by pre_edge_lcm_avs

Reply via email to