re PR tree-optimization/68248 (ICE on valid code at -O3 on x86_64-linux-gnu in unifor...
authorRichard Biener <rguenther@suse.de>
Mon, 9 Nov 2015 14:47:09 +0000 (14:47 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 9 Nov 2015 14:47:09 +0000 (14:47 +0000)
2015-11-09  Richard Biener  <rguenther@suse.de>

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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr68248.c [new file with mode: 0644]
gcc/tree-vect-generic.c

index 56c609fc9ec1d1aea1386157611b8c3909be5573..e7d7c4bc37f3f8ec911e92226994c44e1cc41aa8 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/68248
+       * tree-vect-generic.c (expand_vector_operations_1): Handle
+       scalar rhs2.
+
 2015-11-09  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/56118
index 3809a723828ff65ca9b35e83b05d23fe711e4284..d64a0a2ceb654a5d6097f94ac1a655148925a818 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/68248
+       * gcc.dg/torture/pr68248.c: New testcase.
+
 2015-11-09  Richard Biener  <rguenther@suse.de>
 
        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 (file)
index 0000000..0e8ab49
--- /dev/null
@@ -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;
+    }
+}
index c64fdc4d46a22f844196916187ab313426533f09..f82b6696a34e5cf04e4d350cbf551ddb219f4b61 100644 (file)
@@ -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)))