This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR66636
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Jun 2015 15:51:17 +0200 (CEST)
- Subject: [PATCH] Fix PR66636
- Authentication-results: sourceware.org; auth=none
The following fixes an ICE with 188.ammp and AVX2.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2015-06-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/66636
* tree-vect-stmts.c (vectorizable_store): Properly compute the
def type for further defs for strided stores.
* gcc.dg/vect/pr66636.c: New testcase.
Index: gcc/tree-vect-stmts.c
===================================================================
*** gcc/tree-vect-stmts.c (revision 224834)
--- gcc/tree-vect-stmts.c (working copy)
*************** vectorizable_store (gimple stmt, gimple_
*** 5365,5371 ****
if (slp)
vec_oprnd = vec_oprnds[j];
else
! vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, vec_oprnd);
}
for (i = 0; i < nstores; i++)
--- 5365,5375 ----
if (slp)
vec_oprnd = vec_oprnds[j];
else
! {
! vect_is_simple_use (vec_oprnd, NULL, loop_vinfo,
! bb_vinfo, &def_stmt, &def, &dt);
! vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, vec_oprnd);
! }
}
for (i = 0; i < nstores; i++)
Index: gcc/testsuite/gcc.dg/vect/pr66636.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/pr66636.c (revision 0)
--- gcc/testsuite/gcc.dg/vect/pr66636.c (working copy)
***************
*** 0 ****
--- 1,29 ----
+ /* { dg-additional-options "-mavx2" { target avx_runtime } } */
+
+ #include "tree-vect.h"
+
+ extern void abort (void);
+
+ struct X { double x; double y; };
+
+ void foo (struct X *x, double px, int s)
+ {
+ int i;
+ for (i = 0; i < 256; ++i)
+ {
+ x[i*s].x = px;
+ x[i*s].y = i + px;
+ }
+ }
+
+ int main()
+ {
+ struct X x[512];
+ int i;
+ check_vect ();
+ foo (x, 1., 2);
+ if (x[0].x != 1. || x[0].y != 1.
+ || x[510].x != 1. || x[510].y != 256.)
+ abort ();
+ return 0;
+ }