+2016-06-29 Yuri Rumyantsev <ysrumyan@gmail.com>
+
+ PR tree-optimization/70729
+ * tree-ssa-loop-im.c (ref_indep_loop_p_1): Consider memory reference as
+ independent in loops having positive safelen value.
+ * tree-vect-loop.c (vect_transform_loop): Clear-up safelen value since
+ it may be not valid after vectorization.
+
2016-06-29 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/71625
+2016-06-29 Yuri Rumyantsev <ysrumyan@gmail.com>
+
+ PR tree-optimization/70729
+ * g++.dg/vect/pr70729.cc: New test.
+
2016-06-29 Thomas Schwinge <thomas@codesourcery.com>
* c-c++-common/gomp/cancel-1.c: Extend.
--- /dev/null
+// { dg-do compile }
+// { dg-require-effective-target vect_simd_clones }
+// { dg-additional-options "-Ofast" }
+// { dg-additional-options "-mavx2 -fopenmp-simd" { target x86_64-*-* i?86-*-* } }
+
+
+#include <string.h>
+#include <xmmintrin.h>
+
+inline void* my_alloc(size_t bytes) {return _mm_malloc(bytes, 128);}
+inline void my_free(void* memory) {_mm_free(memory);}
+
+template <typename T>
+class Vec
+{
+ const int isize;
+ T* data;
+
+public:
+
+ Vec (int n) : isize(n) {data = (T*)my_alloc(isize*sizeof(T));}
+ ~Vec () {my_free(data);}
+
+ Vec& operator = (const Vec& other)
+ {
+ if (this != &other)
+ memcpy(data, other.data, isize*sizeof(T));
+ return *this;
+ }
+
+ T& operator [] (int i) {return data[i];}
+ const T& operator [] (int i) const {return data[i];}
+ T& at (int i) {return data[i];}
+ const T& at (int i) const {return data[i];}
+
+ operator T* () {return data;}
+ int size () const {return isize;}
+};
+
+template <typename T>
+class Cl
+{
+public:
+
+ Cl (int n, int m);
+ const int N, M;
+ Vec<T> v_x, v_y;
+ Vec<int> v_i;
+ Vec<float> v_z;
+};
+
+struct Ss
+{
+ const int S_n, S_m;
+ Cl<float> v1;
+ float* C1;
+ float* C2;
+ Ss (int n1, int n2): S_n(n1), S_m(n2), v1(n1, n2)
+ {
+ C1 = new float[n1 * 3];
+ C2 = new float[n2 * 4];
+ }
+
+ ~Ss () { delete C1; delete C2;}
+ void foo (float *in, float w);
+};
+void Ss::foo (float *in, float w)
+{
+#pragma omp simd
+ for (int i=0; i<S_n; i++)
+ {
+ float w1 = C2[S_n + i] * w;
+ v1.v_i[i] += (int)w1;
+ C1[S_n + i] += w1;
+ }
+}
+
+// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } }
if (bitmap_bit_p (refs_to_check, UNANALYZABLE_MEM_ID))
return false;
+ if (loop->safelen > 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf(dump_file,"Consider REF independent in loop#%d\n", loop->num);
+ print_generic_expr(dump_file, ref->mem.ref, TDF_SLIM);
+ fprintf(dump_file, "\n");
+ }
+ return true;
+ }
+
EXECUTE_IF_SET_IN_BITMAP (refs_to_check, 0, i, bi)
{
aref = memory_accesses.refs_list[i];
FOR_EACH_VEC_ELT (LOOP_VINFO_SLP_INSTANCES (loop_vinfo), i, instance)
vect_free_slp_instance (instance);
LOOP_VINFO_SLP_INSTANCES (loop_vinfo).release ();
+ /* Clear-up safelen field since its value is invalid after vectorization
+ since vectorized loop can have loop-carried dependencies. */
+ loop->safelen = 0;
}
/* The code below is trying to perform simple optimization - revert