diff mbox series

RISC-V: Change form of iterating blocks

Message ID 20221228051947.219604-1-juzhe.zhong@rivai.ai
State New
Headers show
Series RISC-V: Change form of iterating blocks | expand

Commit Message

钟居哲 Dec. 28, 2022, 5:19 a.m. UTC
From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (pass_vsetvl::compute_global_backward_infos): Change iterator form.
        (pass_vsetvl::prune_expressions): Change iterator form.

---
 gcc/config/riscv/riscv-vsetvl.cc | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 0d66765e09c..ce1e9e3609f 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1962,10 +1962,11 @@  pass_vsetvl::compute_global_backward_infos (void)
   if (dump_file)
     {
       fprintf (dump_file, "\n\nDirty blocks list: ");
-      for (const bb_info *bb : crtl->ssa->bbs ())
-	if (m_vector_manager->vector_block_infos[bb->index ()]
+      basic_block cfg_bb;
+      FOR_EACH_BB_FN (cfg_bb, cfun)
+	if (m_vector_manager->vector_block_infos[cfg_bb->index]
 	      .reaching_out.dirty_p ())
-	  fprintf (dump_file, "%d ", bb->index ());
+	  fprintf (dump_file, "%d ", cfg_bb->index);
       fprintf (dump_file, "\n\n");
     }
 }
@@ -1974,16 +1975,17 @@  pass_vsetvl::compute_global_backward_infos (void)
 void
 pass_vsetvl::prune_expressions (void)
 {
-  for (const bb_info *bb : crtl->ssa->bbs ())
+  basic_block cfg_bb;
+  FOR_EACH_BB_FN (cfg_bb, cfun)
     {
-      if (m_vector_manager->vector_block_infos[bb->index ()]
+      if (m_vector_manager->vector_block_infos[cfg_bb->index]
 	    .local_dem.valid_or_dirty_p ())
 	m_vector_manager->create_expr (
-	  m_vector_manager->vector_block_infos[bb->index ()].local_dem);
-      if (m_vector_manager->vector_block_infos[bb->index ()]
+	  m_vector_manager->vector_block_infos[cfg_bb->index].local_dem);
+      if (m_vector_manager->vector_block_infos[cfg_bb->index]
 	    .reaching_out.valid_or_dirty_p ())
 	m_vector_manager->create_expr (
-	  m_vector_manager->vector_block_infos[bb->index ()].reaching_out);
+	  m_vector_manager->vector_block_infos[cfg_bb->index].reaching_out);
     }
 
   if (dump_file)