]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/87931 (ICE in vectorizable_reduction, at tree-vect-loop.c...
authorRichard Biener <rguenther@suse.de>
Tue, 13 Nov 2018 15:07:53 +0000 (15:07 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 13 Nov 2018 15:07:53 +0000 (15:07 +0000)
2018-11-13  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87931
* tree-vect-loop.c (vect_is_simple_reduction): Restrict
nested cycles we support to latch computations vectorizable_reduction
handles.

* gcc.dg/graphite/pr87931.c: New testcase.

From-SVN: r266075

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr87931.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index 0b82b956ee449c516df898d15aeb9f3c9989b6d3..f9b23f924ae8184d8b84a6925ead823ae933843e 100644 (file)
@@ -1,3 +1,10 @@
+2018-11-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87931
+       * tree-vect-loop.c (vect_is_simple_reduction): Restrict
+       nested cycles we support to latch computations vectorizable_reduction
+       handles.
+
 2018-11-13  Martin Liska  <mliska@suse.cz>
 
        PR tree-optimization/87885
index 70d9e76834d8448e23d20c6ff46a6ed316d12277..e61f978798ec64be3ed6a56e36df09f29fe3ca33 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87931
+       * gcc.dg/graphite/pr87931.c: New testcase.
+
 2018-11-13  Martin Liska  <mliska@suse.cz>
 
        PR sanitizer/87930
diff --git a/gcc/testsuite/gcc.dg/graphite/pr87931.c b/gcc/testsuite/gcc.dg/graphite/pr87931.c
new file mode 100644 (file)
index 0000000..9ef8610
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-copy-prop -fgraphite-identity" } */
+
+#define N 40
+#define M 128
+float in[N+M];
+float coeff[M];
+float fir_out[N];
+
+void fir ()
+{
+  int i,j,k;
+  float diff;
+
+  for (i = 0; i < N; i++) {
+    diff = 0;
+    for (j = 0; j < M; j++) {
+      diff += in[j+i]*coeff[j];
+    }
+    fir_out[i] = diff;
+  }
+}
index a6f0b823ddafeef3bbbb5ec872f4054103b90b09..1a39b3bb4e99585766b8f16fd0fefe8df83a5598 100644 (file)
@@ -2976,6 +2976,22 @@ vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info,
 
   if (nested_in_vect_loop && !check_reduction)
     {
+      /* FIXME: Even for non-reductions code generation is funneled
+        through vectorizable_reduction for the stmt defining the
+        PHI latch value.  So we have to artificially restrict ourselves
+        for the supported operations.  */
+      switch (get_gimple_rhs_class (code))
+       {
+       case GIMPLE_BINARY_RHS:
+       case GIMPLE_TERNARY_RHS:
+         break;
+       default:
+         /* Not supported by vectorizable_reduction.  */
+         if (dump_enabled_p ())
+           report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt,
+                           "nested cycle: not handled operation: ");
+         return NULL;
+       }
       if (dump_enabled_p ())
        report_vect_op (MSG_NOTE, def_stmt, "detected nested cycle: ");
       return def_stmt_info;