This patch is fixing these bunch of ICE in "vect" testsuite:
FAIL: gcc.dg/vect/no-scevccp-outer-2.c (internal compiler error: in
anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/no-scevccp-outer-2.c (test for excess errors)
FAIL: gcc.dg/vect/pr109025.c (internal compiler error: in
anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/pr109025.c (test for excess errors)
FAIL: gcc.dg/vect/pr109025.c -flto -ffat-lto-objects (internal compiler error:
in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/pr109025.c -flto -ffat-lto-objects (test for excess errors)
FAIL: gcc.dg/vect/pr42604.c (internal compiler error: in
anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/pr42604.c (test for excess errors)
FAIL: gcc.dg/vect/pr42604.c -flto -ffat-lto-objects (internal compiler error:
in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/pr42604.c -flto -ffat-lto-objects (test for excess errors)
FAIL: gcc.dg/vect/vect-double-reduc-3.c (internal compiler error: in
anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/vect-double-reduc-3.c (test for excess errors)
FAIL: gcc.dg/vect/vect-double-reduc-3.c -flto -ffat-lto-objects (internal
compiler error: in anticipatable_occurrence_p, at
config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/vect-double-reduc-3.c -flto -ffat-lto-objects (test for
excess errors)
FAIL: gcc.dg/vect/vect-double-reduc-7.c (internal compiler error: in
anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/vect-double-reduc-7.c (test for excess errors)
FAIL: gcc.dg/vect/vect-double-reduc-7.c -flto -ffat-lto-objects (internal
compiler error: in anticipatable_occurrence_p, at
config/riscv/riscv-vsetvl.cc:314)
FAIL: gcc.dg/vect/vect-double-reduc-7.c -flto -ffat-lto-objects (test for
excess errors)
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (pass_vsetvl::earliest_fusion): Disable
user vsetvl fusion into EMPTY block.
---
gcc/config/riscv/riscv-vsetvl.cc | 37 ++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 682f795c8e1..984252f8fe3 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -3290,6 +3290,24 @@ pass_vsetvl::earliest_fusion (void)
{
if (src_block_info.probability
== profile_probability::uninitialized ()
+ /* We don't do fusion across BBs for user explicit
+ vsetvl instruction for these following reasons:
+
+ - The user vsetvl instruction is configured as
+ no side effects that the previous passes
+ (GSCE, Loop-invariant, ..., etc)
+ should be able to do a good job on optimization
+ of user explicit vsetvls so we don't need to
+ PRE optimization (The user vsetvls should be
+ on the optimal local already before this pass)
+ again for user vsetvls in VSETVL PASS here
+ (Phase 3 && Phase 4).
+
+ - Allowing user vsetvls be optimized in PRE
+ optimization here (Phase 3 && Phase 4) will
+ complicate the codes so much so we prefer user
+ vsetvls be optimized in post-optimization
+ (Phase 5 && Phase 6). */
|| vsetvl_insn_p (expr.get_insn ()->rtl ()))
continue;
new_info = expr.global_merge (expr, eg->src->index);
@@ -3317,6 +3335,25 @@ pass_vsetvl::earliest_fusion (void)
prob = profile_probability::uninitialized ();
}
else if (!src_block_info.reaching_out.compatible_p (expr)
+ /* We don't do fusion across BBs for user explicit
+ vsetvl instruction for these following reasons:
+
+ - The user vsetvl instruction is configured as
+ no side effects that the previous passes
+ (GSCE, Loop-invariant, ..., etc)
+ should be able to do a good job on optimization
+ of user explicit vsetvls so we don't need to
+ PRE optimization (The user vsetvls should be
+ on the optimal local already before this pass)
+ again for user vsetvls in VSETVL PASS here
+ (Phase 3 && Phase 4).
+
+ - Allowing user vsetvls be optimized in PRE
+ optimization here (Phase 3 && Phase 4) will
+ complicate the codes so much so we prefer user
+ vsetvls be optimized in post-optimization
+ (Phase 5 && Phase 6). */
+ && !vsetvl_insn_p (expr.get_insn ()->rtl ())
&& dest_block_info.probability
> src_block_info.probability)
{
--
2.36.3