From 39becbac3d5c936b5cd5fa69d6f04685216f7e38 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Tue, 5 Jul 2011 11:24:26 +0000 Subject: [PATCH] re PR tree-optimization/49518 (ICE in vect_enhance_data_refs_alignment, at tree-vect-data-refs.c:1555) 2011-07-05 Richard Guenther PR tree-optimization/49518 PR tree-optimization/49628 * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Skip irrelevant and invariant data-references. (vect_analyze_data_ref_access): For invariant loads clear the group association. * g++.dg/torture/pr49628.C: New testcase. * gcc.dg/torture/pr49518.c: Likewise. From-SVN: r175847 --- gcc/ChangeLog | 9 +++++++ gcc/testsuite/ChangeLog | 7 +++++ gcc/testsuite/g++.dg/torture/pr49628.C | 37 ++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/torture/pr49518.c | 19 +++++++++++++ gcc/tree-vect-data-refs.c | 12 ++++++++- 5 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr49628.C create mode 100644 gcc/testsuite/gcc.dg/torture/pr49518.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2c592b2671b..154c7cace3d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2011-07-05 Richard Guenther + + PR tree-optimization/49518 + PR tree-optimization/49628 + * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Skip + irrelevant and invariant data-references. + (vect_analyze_data_ref_access): For invariant loads clear the + group association. + 2011-07-04 Jakub Jelinek PR rtl-optimization/49619 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a4b5bbd3f9..5839b726cf3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-07-05 Richard Guenther + + PR tree-optimization/49518 + PR tree-optimization/49628 + * g++.dg/torture/pr49628.C: New testcase. + * gcc.dg/torture/pr49518.c: Likewise. + 2011-07-05 Rainer Orth * ada/acats/run_acats (which): Extract last field from type -p, diff --git a/gcc/testsuite/g++.dg/torture/pr49628.C b/gcc/testsuite/g++.dg/torture/pr49628.C new file mode 100644 index 00000000000..4bc6543a35e --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr49628.C @@ -0,0 +1,37 @@ +/* { dg-do compile } */ + +#include + +template class Tensor; +template class Tensor<1,dim> { +public: + explicit Tensor (const bool initialize = true); + Tensor (const Tensor<1,dim> &); + Tensor<1,dim> & operator = (const Tensor<1,dim> &); + double values[(dim!=0) ? (dim) : 1]; +}; +template +inline Tensor<1,dim> & Tensor<1,dim>::operator = (const Tensor<1,dim> &p) +{ + for (unsigned int i=0; i class Quadrature { +public: + const unsigned int n_quadrature_points; +}; +class MappingQ1 +{ + class InternalData { + public: + std::vector > shape_derivatives; + unsigned int n_shape_functions; + }; + void compute_data (const Quadrature<3> &quadrature, InternalData &data) + const; +}; +void MappingQ1::compute_data (const Quadrature<3> &q, InternalData &data) const +{ + const unsigned int n_q_points = q.n_quadrature_points; + data.shape_derivatives.resize(data.n_shape_functions * n_q_points); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr49518.c b/gcc/testsuite/gcc.dg/torture/pr49518.c new file mode 100644 index 00000000000..84a10fbbeeb --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr49518.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +int a, b; +struct S { unsigned int s, t, u; } c, d = { 0, 1, 0 }; + +void +test (unsigned char z) +{ + char e[] = {0, 0, 0, 0, 1}; + for (c.s = 1; c.s; c.s++) + { + b = e[c.s]; + if (a) + break; + b = z >= c.u; + if (d.t) + break; + } +} diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 1a494233088..28147382aac 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1495,12 +1495,19 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) stmt = DR_STMT (dr); stmt_info = vinfo_for_stmt (stmt); + if (!STMT_VINFO_RELEVANT (stmt_info)) + continue; + /* For interleaving, only the alignment of the first access matters. */ if (STMT_VINFO_STRIDED_ACCESS (stmt_info) && GROUP_FIRST_ELEMENT (stmt_info) != stmt) continue; + /* For invariant accesses there is nothing to enhance. */ + if (integer_zerop (DR_STEP (dr))) + continue; + supportable_dr_alignment = vect_supportable_dr_alignment (dr, true); do_peeling = vector_alignment_reachable_p (dr); if (do_peeling) @@ -2304,7 +2311,10 @@ vect_analyze_data_ref_access (struct data_reference *dr) /* Allow invariant loads in loops. */ if (loop_vinfo && dr_step == 0) - return DR_IS_READ (dr); + { + GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) = NULL; + return DR_IS_READ (dr); + } if (loop && nested_in_vect_loop_p (loop, stmt)) { -- 2.30.2