@@ -3061,6 +3061,30 @@ pre_vsetvl::earliest_fuse_vsetvl_info (int iter)
else
{
vsetvl_info &prev_info = src_block_info.get_exit_info ();
+ if (prev_info.valid_p ()
+ && curr_info.valid_p ()
+ && prev_info.vl_used_by_non_rvv_insn_p ()
+ && !curr_info.vl_used_by_non_rvv_insn_p ())
+ {
+ // Try to merge each demand individually
+ if (m_dem.sew_lmul_compatible_p (prev_info, curr_info))
+ {
+ m_dem.merge_sew_lmul (prev_info, curr_info);
+ }
+ if (m_dem.policy_compatible_p (prev_info, curr_info))
+ {
+ m_dem.merge_policy (prev_info, curr_info);
+ }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " After fusing curr info and "
+ "prev info demands individually:\n");
+ fprintf (dump_file, " prev_info: ");
+ prev_info.dump (dump_file, " ");
+ fprintf (dump_file, " curr_info: ");
+ curr_info.dump (dump_file, " ");
+ }
+ }
if (!prev_info.valid_p ()
|| m_dem.available_p (prev_info, curr_info)
|| !m_dem.compatible_p (prev_info, curr_info))
@@ -18,6 +18,6 @@ void foo(int32_t *in1, int32_t *in2, int32_t *in3, int32_t *out, size_t n, int c
}
}
-/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*m1,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */
+/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*m1,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */
/* { dg-final { scan-assembler-times {vsetvli} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */
/* { dg-final { scan-assembler-times {slli\s+[a-x0-9]+,\s*[a-x0-9]+,\s*5} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */