aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-09-05 11:55:50 +0200
committerRichard Biener <rguenther@suse.de>2025-09-05 13:11:39 +0200
commit2965a67c7ef34de74904b600a3e4a4cc858ea37b (patch)
tree16bd0e3095c2fccee5be4030647c58795243407d
parentdad6f6eb9b3c96a7fd6c13836a85a4f66373ff0c (diff)
downloadgcc-2965a67c7ef34de74904b600a3e4a4cc858ea37b.zip
gcc-2965a67c7ef34de74904b600a3e4a4cc858ea37b.tar.gz
gcc-2965a67c7ef34de74904b600a3e4a4cc858ea37b.tar.bz2
Avoid costing vector stmts with count == 0
This avoids confusing the backends. * tree-vect-slp.cc (vectorizable_bb_reduc_epilogue): Do not cost zero remaining scalar stmts. (vectorizable_slp_permutation): Do not cost zero actual permutations. * tree-vect-stmts.cc (vectorizable_load): Likewise.
-rw-r--r--gcc/tree-vect-slp.cc7
-rw-r--r--gcc/tree-vect-stmts.cc5
2 files changed, 7 insertions, 5 deletions
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 6258a8e..59bca1d 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -8701,8 +8701,9 @@ vectorizable_bb_reduc_epilogue (slp_instance instance,
/* Since we replace all stmts of a possibly longer scalar reduction
chain account for the extra scalar stmts for that. */
- record_stmt_cost (cost_vec, instance->remain_defs.length (), scalar_stmt,
- instance->root_stmts[0], 0, vect_body);
+ if (!instance->remain_defs.is_empty ())
+ record_stmt_cost (cost_vec, instance->remain_defs.length (), scalar_stmt,
+ instance->root_stmts[0], 0, vect_body);
return true;
}
@@ -11370,7 +11371,7 @@ vectorizable_slp_permutation (vec_info *vinfo, gimple_stmt_iterator *gsi,
if (nperms < 0)
return false;
- if (!gsi)
+ if (!gsi && nperms != 0)
record_stmt_cost (cost_vec, nperms, vec_perm, node, vectype, 0, vect_body);
return true;
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index edc669b..9fcc2fd 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -11387,8 +11387,9 @@ vectorizable_load (vec_info *vinfo,
{
vect_transform_slp_perm_load (vinfo, slp_node, vNULL, nullptr, vf,
true, &n_perms, nullptr);
- inside_cost = record_stmt_cost (cost_vec, n_perms, vec_perm,
- slp_node, 0, vect_body);
+ if (n_perms != 0)
+ inside_cost = record_stmt_cost (cost_vec, n_perms, vec_perm,
+ slp_node, 0, vect_body);
}
else
{