aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-09-07 11:52:01 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-09-07 11:52:01 +0200
commit44a06a709565805d68994b65d871565a07ebf73e (patch)
tree0403de63771e03f52c106164c651f886815adc0a /gcc
parent8b2d8beb9fcbd9196b562b17a21c892ff062aba8 (diff)
downloadgcc-44a06a709565805d68994b65d871565a07ebf73e.zip
gcc-44a06a709565805d68994b65d871565a07ebf73e.tar.gz
gcc-44a06a709565805d68994b65d871565a07ebf73e.tar.bz2
re PR tree-optimization/91665 (ICE in build_vector_from_val, at tree.c:1904)
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: r275486
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr91665.c15
-rw-r--r--gcc/tree-vect-loop.c5
4 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf85829..83581ac4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2019-09-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR target/91684
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9d2c3d2..a53887a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/91665
+ * gcc.dg/vect/pr91665.c: New test.
+
2019-09-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR target/91684
diff --git a/gcc/testsuite/gcc.dg/vect/pr91665.c b/gcc/testsuite/gcc.dg/vect/pr91665.c
new file mode 100644
index 0000000..6b69ea0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr91665.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/91665 */
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+
+short int v;
+
+void
+foo (short int x, short int y)
+{
+ short int *p = &v;
+
+ x = 1;
+ while (x != 0)
+ x += ++y || (*p = x);
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index b0cbbac..8324492 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -6656,10 +6656,13 @@ vectorizable_reduction (stmt_vec_info stmt_info, 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)