diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-11-21 18:12:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-11-21 18:12:06 +0100 |
commit | 7da11884fe193328bb05ce1f39b8c5a5f45022c1 (patch) | |
tree | 596c0df8c66c54df172921f9e503edc5c4088aa2 /gcc/tree-vect-loop.c | |
parent | 2ff2d92fa0e83d1ea27011efc0996136713f5c79 (diff) | |
download | gcc-7da11884fe193328bb05ce1f39b8c5a5f45022c1.zip gcc-7da11884fe193328bb05ce1f39b8c5a5f45022c1.tar.gz gcc-7da11884fe193328bb05ce1f39b8c5a5f45022c1.tar.bz2 |
backport: re PR tree-optimization/91665 (ICE in build_vector_from_val, at tree.c:1904)
Backported from mainline
2019-09-07 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91665
* tree-vect-loop.c (vectorizable_reduction): Punt if base has type
incompatible with the type of PHI result.
* gcc.dg/vect/pr91665.c: New test.
From-SVN: r278576
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index e50dca91..ce87614 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6808,10 +6808,13 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, gcc_assert (TREE_CODE (base) == INTEGER_CST && TREE_CODE (step) == INTEGER_CST); cond_reduc_val = NULL_TREE; + tree res = PHI_RESULT (STMT_VINFO_STMT (cond_stmt_vinfo)); + if (!types_compatible_p (TREE_TYPE (res), TREE_TYPE (base))) + ; /* Find a suitable value, for MAX_EXPR below base, for MIN_EXPR above base; punt if base is the minimum value of the type for MAX_EXPR or maximum value of the type for MIN_EXPR for now. */ - if (tree_int_cst_sgn (step) == -1) + else if (tree_int_cst_sgn (step) == -1) { cond_reduc_op_code = MIN_EXPR; if (tree_int_cst_sgn (base) == -1) |