public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Use dominance analysis in global vsetvl elimination
@ 2023-09-11 13:39 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2023-09-11 13:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f454746d2881520fccb29534911a5e6409a51ed6

commit f454746d2881520fccb29534911a5e6409a51ed6
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Mon Sep 11 11:33:59 2023 +0800

    RISC-V: Use dominance analysis in global vsetvl elimination
    
    I found that it's more reasonable to use existing dominance analysis.
    
    gcc/ChangeLog:
    
            * config/riscv/riscv-vsetvl.cc (pass_vsetvl::global_eliminate_vsetvl_insn):
            Use dominance analysis.
            (pass_vsetvl::init): Ditto.
            (pass_vsetvl::done): Ditto.
    
    (cherry picked from commit 7f9083ffe262cb14c49d042fc6363514badea6cb)

Diff:
---
 gcc/config/riscv/riscv-vsetvl.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 134b97737ae5..f81361c4ccd1 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -4054,7 +4054,7 @@ pass_vsetvl::global_eliminate_vsetvl_insn (const bb_info *bb) const
     }
 
   /* Step1: Reshape the VL/VTYPE status to make sure everything compatible.  */
-  hash_set<basic_block> pred_cfg_bbs = get_all_predecessors (cfg_bb);
+  auto_vec<basic_block> pred_cfg_bbs = get_dominated_by (CDI_POST_DOMINATORS, cfg_bb);
   FOR_EACH_EDGE (e, ei, cfg_bb->preds)
     {
       sbitmap avout = m_vector_manager->vector_avout[e->src->index];
@@ -4243,6 +4243,7 @@ pass_vsetvl::init (void)
     {
       /* Initialization of RTL_SSA.  */
       calculate_dominance_info (CDI_DOMINATORS);
+      calculate_dominance_info (CDI_POST_DOMINATORS);
       df_analyze ();
       crtl->ssa = new function_info (cfun);
     }
@@ -4264,6 +4265,7 @@ pass_vsetvl::done (void)
     {
       /* Finalization of RTL_SSA.  */
       free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
       if (crtl->ssa->perform_pending_updates ())
 	cleanup_cfg (0);
       delete crtl->ssa;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-11 13:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 13:39 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Use dominance analysis in global vsetvl elimination Jeff Law

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).