diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index ca57dddf1d9..1500f8811ef 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -118,11 +118,13 @@ enum stringop_strategy_enum { /* Behavior of VSETVL Pass. */ enum vsetvl_strategy_enum { - /* Simple: Insert a vsetvl* instruction for each Vector instruction. */ - VSETVL_SIMPLE = 1, /* Optimized: Run LCM dataflow analysis to reduce vsetvl* insns and delete any redundant ones generated in the process. */ - VSETVL_OPT = 2 + VSETVL_OPT, + /* Simple: Insert a vsetvl* instruction for each Vector instruction. */ + VSETVL_SIMPLE, + /* No fusion: Disable Phase 2 earliest global fusion. */ + VSETVL_OPT_NO_FUSION, }; #define TARGET_ZICOND_LIKE (TARGET_ZICOND || (TARGET_XVENTANACONDOPS && TARGET_64BIT)) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 170fc7f003d..53d954e1dff 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -3495,16 +3495,18 @@ pass_vsetvl::lazy_vsetvl () /* Phase 2: Fuse header and footer vsetvl infos between basic blocks. */ if (dump_file) fprintf (dump_file, "\nPhase 2: Lift up vsetvl info.\n\n"); - bool changed; - int fused_count = 0; - do + if (vsetvl_strategy != VSETVL_OPT_NO_FUSION) { - if (dump_file) - fprintf (dump_file, " Try lift up %d.\n\n", fused_count); - changed = pre.earliest_fuse_vsetvl_info (fused_count); - fused_count += 1; - } while (changed); - + bool changed = true; + int fused_count = 0; + do + { + if (dump_file) + fprintf (dump_file, " Try lift up %d.\n\n", fused_count); + changed = pre.earliest_fuse_vsetvl_info (fused_count); + fused_count += 1; + } while (changed); + } if (dump_file && (dump_flags & TDF_DETAILS)) pre.dump (dump_file, "phase 2"); @@ -3545,7 +3547,7 @@ pass_vsetvl::execute (function *) if (!has_vector_insn (cfun)) return 0; - if (!optimize || vsetvl_strategy & VSETVL_SIMPLE) + if (!optimize || vsetvl_strategy == VSETVL_SIMPLE) simple_vsetvl (); else lazy_vsetvl (); diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt index 65c656204ca..7c2292d8f91 100644 --- a/gcc/config/riscv/riscv.opt +++ b/gcc/config/riscv/riscv.opt @@ -552,11 +552,14 @@ Enum Name(vsetvl_strategy) Type(enum vsetvl_strategy_enum) Valid arguments to -param=vsetvl-strategy=: +EnumValue +Enum(vsetvl_strategy) String(optim) Value(VSETVL_OPT) + EnumValue Enum(vsetvl_strategy) String(simple) Value(VSETVL_SIMPLE) EnumValue -Enum(vsetvl_strategy) String(optim) Value(VSETVL_OPT) +Enum(vsetvl_strategy) String(optim-no-fusion) Value(VSETVL_OPT_NO_FUSION) -param=vsetvl-strategy= Target Undocumented RejectNegative Joined Enum(vsetvl_strategy) Var(vsetvl_strategy) Init(VSETVL_OPT)