diff options
author | Richard Biener <rguenther@suse.de> | 2017-09-25 11:40:23 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-09-25 11:40:23 +0000 |
commit | d362ac6c6d5a9419d9b7a0db84155a065e113434 (patch) | |
tree | 8340c3bcb0ae35deec3fc34e274fac0655a9d27f | |
parent | fb202364391854f7c16eee74c270b0d78ad8f532 (diff) | |
download | gcc-d362ac6c6d5a9419d9b7a0db84155a065e113434.zip gcc-d362ac6c6d5a9419d9b7a0db84155a065e113434.tar.gz gcc-d362ac6c6d5a9419d9b7a0db84155a065e113434.tar.bz2 |
re PR tree-optimization/82285 (Optimizing error when using enumeration)
2017-09-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/82285
* tree-vect-patterns.c (vect_recog_bool_pattern): Also handle
enumeral types.
* gcc.dg/torture/pr82285.c: New testcase.
From-SVN: r253146
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr82285.c | 16 | ||||
-rw-r--r-- | gcc/tree-vect-patterns.c | 2 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b379b7..f618113 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/82285 + * tree-vect-patterns.c (vect_recog_bool_pattern): Also handle + enumeral types. + 2017-09-25 Tom de Vries <tom@codesourcery.com> PR target/80035 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6a25a14..333e2c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/82285 + * gcc.dg/torture/pr82285.c: New testcase. + 2017-09-25 Justin Squirek <squirek@adacore.com> * gnat.dg/entry_family.adb: New testcase diff --git a/gcc/testsuite/gcc.dg/torture/pr82285.c b/gcc/testsuite/gcc.dg/torture/pr82285.c new file mode 100644 index 0000000..6edc750 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr82285.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ + +enum tst { first = 0, second = 1 }; + +int +main () +{ + enum tst data[16]; + + for (unsigned i = 0; i < 16; i++) + data[i] = (i < 5 ? second : first); + + if (data[2] != second) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index cdad261..ed0879e 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -3643,7 +3643,7 @@ vect_recog_bool_pattern (vec<gimple *> *stmts, tree *type_in, rhs_code = gimple_assign_rhs_code (last_stmt); if (CONVERT_EXPR_CODE_P (rhs_code)) { - if (TREE_CODE (TREE_TYPE (lhs)) != INTEGER_TYPE + if (! INTEGRAL_TYPE_P (TREE_TYPE (lhs)) || TYPE_PRECISION (TREE_TYPE (lhs)) == 1) return NULL; vectype = get_vectype_for_scalar_type (TREE_TYPE (lhs)); |