aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-05-29 15:06:23 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2015-05-29 15:06:23 +0200
commit2395a8ea086886c24090f1c9e9dde2515dc2fda8 (patch)
treec894b409080257241f8d72971627df9474722fca /gcc
parent52fc6859fe39a811a2a5ca81813e27cf1800b9c2 (diff)
downloadgcc-2395a8ea086886c24090f1c9e9dde2515dc2fda8.zip
gcc-2395a8ea086886c24090f1c9e9dde2515dc2fda8.tar.gz
gcc-2395a8ea086886c24090f1c9e9dde2515dc2fda8.tar.bz2
re PR tree-optimization/66142 (Loop is not vectorized because not sufficient support for GOMP_SIMD_LANE)
PR tree-optimization/66142 * tree-if-conv.c (if_convertible_phi_p): Don't give up on virtual phis that feed themselves. * gcc.dg/vect/pr66142.c: New test. From-SVN: r223863
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr66142.c44
-rw-r--r--gcc/tree-if-conv.c3
4 files changed, 57 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a5941a6..c8b1c44 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/66142
+ * tree-if-conv.c (if_convertible_phi_p): Don't give up on
+ virtual phis that feed themselves.
+
2015-05-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/66314
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a1485b3..fe9ee3c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/66142
+ * gcc.dg/vect/pr66142.c: New test.
+
2015-05-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/66314
diff --git a/gcc/testsuite/gcc.dg/vect/pr66142.c b/gcc/testsuite/gcc.dg/vect/pr66142.c
new file mode 100644
index 0000000..94854ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr66142.c
@@ -0,0 +1,44 @@
+/* PR middle-end/66142 */
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math -fopenmp-simd" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+struct A { float x, y; };
+struct B { struct A t, w; };
+
+static inline float
+bar (const struct B *x)
+{
+ struct A r;
+ float b, c, d;
+ r.x = x->t.x;
+ r.y = x->t.y;
+ b = r.x * x->w.x + r.y * x->w.y;
+ c = b + r.x * r.x + r.y * r.y;
+ if (c > 0.0f)
+ return c + 3.0f;
+ return 0.0f;
+}
+
+void
+foo (float *a, float *b, float *c)
+{
+ int i;
+ float z = 0.0f;
+ float u = *a;
+#pragma omp simd
+ for (i = 0; i < 32; i++)
+ {
+ float x = b[i];
+ float y = c[i];
+ struct B r;
+ r.t.x = 1.0f;
+ r.t.y = u;
+ r.w.x = x;
+ r.w.y = y;
+ z += bar (&r);
+ }
+ *a = z;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 1 "vect" { target vect_condition } } } */
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index a85c7a2..28e1c47 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -594,7 +594,8 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, gphi *phi,
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_phi_result (phi))
{
- if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI)
+ if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI
+ && USE_STMT (use_p) != (gimple) phi)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Difficult to handle this virtual phi.\n");