[Committed] RISC-V: Add optim-no-fusion compile option [VSETVL PASS]
Checks
Commit Message
This patch adds no fusion compile option to disable phase 2 global fusion.
It can help us to analyze the compile-time and debugging.
Committed.
gcc/ChangeLog:
* config/riscv/riscv-opts.h (enum vsetvl_strategy_enum): Add optim-no-fusion option.
* config/riscv/riscv-vsetvl.cc (pass_vsetvl::lazy_vsetvl): Ditto.
(pass_vsetvl::execute): Ditto.
* config/riscv/riscv.opt: Ditto.
---
gcc/config/riscv/riscv-opts.h | 8 +++++---
gcc/config/riscv/riscv-vsetvl.cc | 22 ++++++++++++----------
gcc/config/riscv/riscv.opt | 5 ++++-
3 files changed, 21 insertions(+), 14 deletions(-)
@@ -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))
@@ -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 ();
@@ -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)