From 0b3ecf755196df79c795c8b9bbcb735adbb604d0 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 9 Nov 2015 14:47:09 +0000 Subject: [PATCH] re PR tree-optimization/68248 (ICE on valid code at -O3 on x86_64-linux-gnu in uniform_vector_p, at tree.c:10807) 2015-11-09 Richard Biener PR tree-optimization/68248 * tree-vect-generic.c (expand_vector_operations_1): Handle scalar rhs2. * gcc.dg/torture/pr68248.c: New testcase. From-SVN: r230021 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr68248.c | 20 ++++++++++++++++++++ gcc/tree-vect-generic.c | 2 ++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr68248.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56c609fc9ec..e7d7c4bc37f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-11-09 Richard Biener + + PR tree-optimization/68248 + * tree-vect-generic.c (expand_vector_operations_1): Handle + scalar rhs2. + 2015-11-09 Richard Biener PR tree-optimization/56118 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3809a723828..d64a0a2ceb6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-09 Richard Biener + + PR tree-optimization/68248 + * gcc.dg/torture/pr68248.c: New testcase. + 2015-11-09 Richard Biener PR tree-optimization/56118 diff --git a/gcc/testsuite/gcc.dg/torture/pr68248.c b/gcc/testsuite/gcc.dg/torture/pr68248.c new file mode 100644 index 00000000000..0e8ab4904aa --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68248.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int a, b, c, d; + +int +fn1 (int p1) +{ + return a > 0 ? p1 : p1 >> a; +} + +void +fn2 () +{ + char e; + for (; c; c++) + { + e = fn1 (!d ^ 2); + b ^= e; + } +} diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index c64fdc4d46a..f82b6696a34 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -1527,6 +1527,8 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi) tree srhs1, srhs2 = NULL_TREE; if ((srhs1 = ssa_uniform_vector_p (rhs1)) != NULL_TREE && (rhs2 == NULL_TREE + || (! VECTOR_TYPE_P (TREE_TYPE (rhs2)) + && (srhs2 = rhs2)) || (srhs2 = ssa_uniform_vector_p (rhs2)) != NULL_TREE) /* As we query direct optabs restrict to non-convert operations. */ && TYPE_MODE (TREE_TYPE (type)) == TYPE_MODE (TREE_TYPE (srhs1))) -- 2.30.2