aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-02-04 12:08:47 +0100
committerRichard Biener <rguenther@suse.de>2021-02-04 13:02:09 +0100
commit7002a33d1ba81e4577d965fb9daaee146b31faa8 (patch)
tree75b50e60b8279147077ef320209b7bd1ac11358f /gcc/tree-vect-slp.c
parentf0e618faeb619ec02dabbef203a5575fca44a7f7 (diff)
downloadgcc-7002a33d1ba81e4577d965fb9daaee146b31faa8.zip
gcc-7002a33d1ba81e4577d965fb9daaee146b31faa8.tar.gz
gcc-7002a33d1ba81e4577d965fb9daaee146b31faa8.tar.bz2
tree-optimization/98855 - fix some vectorizer cost issues
This fixes us not costing vectorized bswap for SLP as well as avoiding biasing to the vectorized side when costing single-argument PHIs. Instead we assume coalescing here and cost them with zero cost for both the scalar and vectorized code. This doesn't fix the PR on its own. 2021-02-04 Richard Biener <rguenther@suse.de> PR tree-optimization/98855 * tree-vect-loop.c (vectorizable_phi): Do not cost single-argument PHIs. * tree-vect-slp.c (vect_bb_slp_scalar_cost): Likewise. * tree-vect-stmts.c (vectorizable_bswap): Also perform costing for SLP operation.
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 10b876f..2305bbd 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -4297,6 +4297,13 @@ vect_bb_slp_scalar_cost (vec_info *vinfo,
}
else if (vect_nop_conversion_p (orig_stmt_info))
continue;
+ /* For single-argument PHIs assume coalescing which means zero cost
+ for the scalar and the vector PHIs. This avoids artificially
+ favoring the vector path (but may pessimize it in some cases). */
+ else if (is_a <gphi *> (orig_stmt_info->stmt)
+ && gimple_phi_num_args
+ (as_a <gphi *> (orig_stmt_info->stmt)) == 1)
+ continue;
else
kind = scalar_stmt;
record_stmt_cost (cost_vec, 1, kind, orig_stmt_info,