From b756d03533d7d0c92bd6a252cd4f3260973e93f5 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 4 May 2026 14:08:07 +0200 Subject: [PATCH] tree-optimization/125124 - disable sanity checking of BB SLP partitioning The following disables a sanity check that BB SLP partitioning correctly partitioned the SLP graph. PR tree-optimization/125124 * tree-vect-slp.cc (vect_bb_slp_scalar_cost): Disable BB SLP partitioning sanity-check. * gcc.dg/torture/pr125124.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr125124.c | 23 +++++++++++++++++++++++ gcc/tree-vect-slp.cc | 9 ++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr125124.c diff --git a/gcc/testsuite/gcc.dg/torture/pr125124.c b/gcc/testsuite/gcc.dg/torture/pr125124.c new file mode 100644 index 00000000000..dd087a899b6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr125124.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +char ff_rv60_idct16x16_add_dst_1, ff_rv60_idct16x16_add___trans_tmp_1; +short ff_rv60_idct16x16_add_tmp[56]; +void ff_rv60_idct16x16_add() { + for (int y; y; y++) { + int tmp00 = 31 * ff_rv60_idct16x16_add_tmp[y * 16] - + 7 * ff_rv60_idct16x16_add_tmp[y * 16 + 1] - + 6 * ff_rv60_idct16x16_add_tmp[y * 16 + 10] - + 20 * ff_rv60_idct16x16_add_tmp[y * 16 + 4], + tmp02 = 20 * ff_rv60_idct16x16_add_tmp[y * 16] - + 6 * ff_rv60_idct16x16_add_tmp[y * 16 + 1] + + 7 * ff_rv60_idct16x16_add_tmp[y * 16 + 10] + + 31 * ff_rv60_idct16x16_add_tmp[y * 16 + 4]; + ff_rv60_idct16x16_add_dst_1 = (tmp00 >> 7) + (tmp02 >> 7); + { + if (ff_rv60_idct16x16_add_dst_1) + ff_rv60_idct16x16_add___trans_tmp_1 = ff_rv60_idct16x16_add_dst_1; + } + ff_rv60_idct16x16_add_dst_1 = ff_rv60_idct16x16_add___trans_tmp_1; + } +} diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 17b8dc5b9dc..40ddae3526b 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -9452,7 +9452,14 @@ vect_bb_slp_scalar_cost (bb_vec_info vinfo, continue; } - gcc_assert (!gimple_visited_p (stmt->stmt)); + /* The following assert verifies that vect_bb_partition_graph + partitions the SLP graph in a way that each scalar stmt of + the coverage of the SLP graph belongs to exactly one subgraph. + ??? This is currently not guaranteed since the function + works purely on SLP_TREE_SCALAR_STMTS, resulting in the assert + tripping or scalar stmts costed multiple times, making vectorization + more profitable than it really is. */ + /* gcc_checking_assert (!gimple_visited_p (stmt->stmt)); */ if (vect_nop_conversion_p (stmt)) ;