re PR tree-optimization/71407 (ICE at -O3 in 32-bit and 64-bit modes on x86_64-linux...
authorAlan Hayward <alan.hayward@arm.com>
Fri, 10 Jun 2016 08:46:55 +0000 (08:46 +0000)
committerAlan Hayward <alahay01@gcc.gnu.org>
Fri, 10 Jun 2016 08:46:55 +0000 (08:46 +0000)
2016-06-10  Alan Hayward  <alan.hayward@arm.com>

gcc/
PR tree-optimization/71407
PR tree-optimization/71416
* tree-vect-loop.c (vectorizable_live_operation): Use vectype for
BIT_FIELD_REF type.

testsuite/
PR tree-optimization/71407
PR tree-optimization/71416
* gcc.dg/vect/pr71407.c: New
* gcc.dg/vect/pr71416-1.c: New
* gcc.dg/vect/pr71416-2.c: New

From-SVN: r237288

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr71407.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr71416-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr71416-2.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index c589250be68ced74f89d7c72e11b7ed93d3c986f..3f7240cf92fc024f48700c6cd10015753e528c6c 100644 (file)
@@ -1,3 +1,10 @@
+2016-06-10  Alan Hayward  <alan.hayward@arm.com>
+
+       PR tree-optimization/71407
+       PR tree-optimization/71416
+       * tree-vect-loop.c (vectorizable_live_operation): Use vectype for
+       BIT_FIELD_REF type.
+
 2016-06-10  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/71477
index c93f6fae010f4b34a8939bda2e1545689ba27e63..ae3f462cbb0b1eea72da605aadafa3ef240bf8d1 100644 (file)
@@ -1,3 +1,11 @@
+2016-06-10  Alan Hayward  <alan.hayward@arm.com>
+
+       PR tree-optimization/71407
+       PR tree-optimization/71416
+       * gcc.dg/vect/pr71407.c: New
+       * gcc.dg/vect/pr71416-1.c: New
+       * gcc.dg/vect/pr71416-2.c: New
+
 2016-06-10  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/71477
diff --git a/gcc/testsuite/gcc.dg/vect/pr71407.c b/gcc/testsuite/gcc.dg/vect/pr71407.c
new file mode 100644 (file)
index 0000000..761990d
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+int a, c, d;
+short b;
+
+void
+fn1 ()
+{
+  int e;
+  for (; c; c++)
+    {
+      for (; a; a++)
+        b = (short) a || e;
+      e = d;
+    }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr71416-1.c b/gcc/testsuite/gcc.dg/vect/pr71416-1.c
new file mode 100644 (file)
index 0000000..8a28548
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+
+short a;
+char b, e;
+static short c;
+int d, f;
+int main() {
+  short g;
+  for (; e; ++e) {
+    d = a;
+    f = 0;
+    if (b)
+      d = f = g >= c;
+  }
+  return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/vect/pr71416-2.c b/gcc/testsuite/gcc.dg/vect/pr71416-2.c
new file mode 100644 (file)
index 0000000..d846ef1
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+int a, b, d, e, f, g;
+int *c;
+void fn2 (int *);
+void fn1() { fn2(&e); }
+
+void fn2(int *p1) {
+  for (;;) {
+    for (; a; a++)
+      if (*p1 = g || --f, b)
+        if (*c)
+          d = *p1;
+    if (*p1)
+      break;
+  }
+}
index 1f61c83deafa003529273e21f68bc48d3e6446b9..1231b95f6a71337833e8c4b24884da9f96a7b5bf 100644 (file)
@@ -6353,7 +6353,7 @@ vectorizable_live_operation (gimple *stmt,
        worklist.safe_push (use_stmt);
   gcc_assert (worklist.length () == 1);
 
-  bitsize = TYPE_SIZE (lhs_type);
+  bitsize = TYPE_SIZE (TREE_TYPE (vectype));
   vec_bitsize = TYPE_SIZE (vectype);
 
   /* Get the vectorized lhs of STMT and the lane to use (counted in bits).  */
@@ -6399,15 +6399,18 @@ vectorizable_live_operation (gimple *stmt,
 
   /* Create a new vectorized stmt for the uses of STMT and insert outside the
      loop.  */
-  tree new_name = make_ssa_name (lhs_type);
-  tree new_tree = build3 (BIT_FIELD_REF, lhs_type, vec_lhs, bitsize, bitstart);
-  gimple *new_stmt = gimple_build_assign (new_name, new_tree);
-  gsi_insert_on_edge_immediate (single_exit (loop), new_stmt);
+  gimple_seq stmts = NULL;
+  tree new_tree = build3 (BIT_FIELD_REF, TREE_TYPE (vectype), vec_lhs, bitsize,
+                         bitstart);
+  new_tree = force_gimple_operand (fold_convert (lhs_type, new_tree), &stmts,
+                                  true, NULL_TREE);
+  if (stmts)
+    gsi_insert_seq_on_edge_immediate (single_exit (loop), stmts);
 
   /* Replace all uses of the USE_STMT in the worklist with the newly inserted
      statement.  */
   use_stmt = worklist.pop ();
-  replace_uses_by (gimple_phi_result (use_stmt), new_name);
+  replace_uses_by (gimple_phi_result (use_stmt), new_tree);
   update_stmt (use_stmt);
 
   return true;