aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-patterns.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-02-02 10:32:23 +0100
committerJakub Jelinek <jakub@redhat.com>2021-02-02 10:32:23 +0100
commit1592b74350a0311e4c95a0192ea9c943847e7bc0 (patch)
treee301c3575710b10519cca077ac0b275308ed6f7d /gcc/tree-vect-patterns.c
parenteedda4e160856b7ac0c533ac9445161d0fd88660 (diff)
downloadgcc-1592b74350a0311e4c95a0192ea9c943847e7bc0.zip
gcc-1592b74350a0311e4c95a0192ea9c943847e7bc0.tar.gz
gcc-1592b74350a0311e4c95a0192ea9c943847e7bc0.tar.bz2
tree-vect-patterns: Don't create over widening patterns for stmts used in reductions [PR98848]
As discussed in the PR, the reduction code isn't able to cope with type promotions/demotions in the reduction computation, so if we recognize an over-widening pattern that has vect_reduction_def type, we most likely make it non-vectorizable. 2021-02-02 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/98848 * tree-vect-patterns.c (vect_recog_over_widening_pattern): Punt if STMT_VINFO_DEF_TYPE (last_stmt_info) is vect_reduction_def. * gcc.dg/vect/pr98848.c: New test. * gcc.dg/vect/pr92205.c: Remove xfail.
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r--gcc/tree-vect-patterns.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 2197265..b575b45 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1579,6 +1579,10 @@ vect_recog_over_widening_pattern (vec_info *vinfo,
tree type = TREE_TYPE (lhs);
tree_code code = gimple_assign_rhs_code (last_stmt);
+ /* Punt for reductions where we don't handle the type conversions. */
+ if (STMT_VINFO_DEF_TYPE (last_stmt_info) == vect_reduction_def)
+ return NULL;
+
/* Keep the first operand of a COND_EXPR as-is: only the other two
operands are interesting. */
unsigned int first_op = (code == COND_EXPR ? 2 : 1);