https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113495
--- Comment #12 from JuzheZhong <juzhe.zhong at rivai dot ai> --- Ok. Here is a simple fix which give some hints: diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 2067073185f..ede818140dc 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -2719,10 +2719,11 @@ pre_vsetvl::compute_lcm_local_properties () for (int i = 0; i < num_exprs; i += 1) { const vsetvl_info &info = *m_exprs[i]; - if (!info.has_nonvlmax_reg_avl () && !info.has_vl ()) + bool has_nonvlmax_reg_avl_p = info.has_nonvlmax_reg_avl (); + if (!has_nonvlmax_reg_avl_p && !info.has_vl ()) continue; - if (info.has_nonvlmax_reg_avl ()) + if (has_nonvlmax_reg_avl_p) { unsigned int regno; sbitmap_iterator sbi; @@ -3556,7 +3557,7 @@ const pass_data pass_data_vsetvl = { RTL_PASS, /* type */ "vsetvl", /* name */ OPTGROUP_NONE, /* optinfo_flags */ - TV_NONE, /* tv_id */ + TV_MACH_DEP, /* tv_id */ 0, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ Memory usage from 931M -> 781M. Memory usage reduce significantly. Note that I didn't change all has_nonvlmax_reg_avl, We have so many places calling has_nonvlmax_reg_avl...