diff options
author | Dorit Nuzman <dorit@gcc.gnu.org> | 2007-10-23 03:24:06 +0000 |
---|---|---|
committer | Dorit Nuzman <dorit@gcc.gnu.org> | 2007-10-23 03:24:06 +0000 |
commit | 7de5c6a447ac4c86d737b350b7458c6fe428194c (patch) | |
tree | db2eee15afd72fa434218c912f0986a5697a1aa1 /gcc | |
parent | fc629e9660f855d8ff75f366c2ff7a222544193d (diff) | |
download | gcc-7de5c6a447ac4c86d737b350b7458c6fe428194c.zip gcc-7de5c6a447ac4c86d737b350b7458c6fe428194c.tar.gz gcc-7de5c6a447ac4c86d737b350b7458c6fe428194c.tar.bz2 |
re PR tree-optimization/33834 (ICE in vect_get_vec_def_for_operand, at tree-vect-transform.c:1829)
PR tree-optimization/33834
PR tree-optimization/33835
* tree-vect-analyze.c (vect_analyze_operations): RELEVANT and LIVE stmts
need to be checked for success seperately.
* tree-vect-transform.c (vectorizable_call, vectorizable_conversion):
Remove the check that stmt is not LIVE.
(vectorizable_assignment, vectorizable_induction): Likewise.
(vectorizable_operation, vectorizable_type_demotion): Likewise.
(vectorizable_type_promotion, vectorizable_load, vectorizable_store):
Likewise.
(vectorizable_live_operation): Check that op is not NULL.
From-SVN: r129571
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/vect/pr33834_1.cc | 50 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/vect/pr33834_2.cc | 32 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/vect/pr33835.cc | 50 | ||||
-rw-r--r-- | gcc/tree-vect-analyze.c | 24 | ||||
-rw-r--r-- | gcc/tree-vect-transform.c | 73 |
7 files changed, 176 insertions, 76 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 419c308..390ed0d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2007-10-22 Dorit Nuzman <dorit@il.ibm.com> + + PR tree-optimization/33834 + PR tree-optimization/33835 + * tree-vect-analyze.c (vect_analyze_operations): RELEVANT and LIVE stmts + need to be checked for success seperately. + * tree-vect-transform.c (vectorizable_call, vectorizable_conversion): + Remove the check that stmt is not LIVE. + (vectorizable_assignment, vectorizable_induction): Likewise. + (vectorizable_operation, vectorizable_type_demotion): Likewise. + (vectorizable_type_promotion, vectorizable_load, vectorizable_store): + Likewise. + (vectorizable_live_operation): Check that op is not NULL. + 2007-10-22 Janis Johnson <janis187@us.ibm.com> * doc/invoke.texi (Optimization Options): In the summary, show diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 01f6cd5..ecc4e80 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2007-10-22 Martin Michlmayr <tbm@cyrius.com> + Dorit Nuzman <dorit@il.ibm.com> + + PR tree-optimization/33834 + PR tree-optimization/33835 + * g++.dg/vect/pr33834_1.cc: New test. + * g++.dg/vect/pr33834_2.cc: New test. + * g++.dg/vect/pr33835.cc: New test. + 2007-10-22 Jakub Jelinek <jakub@redhat.com> * gcc.dg/pr33644.c: New test. diff --git a/gcc/testsuite/g++.dg/vect/pr33834_1.cc b/gcc/testsuite/g++.dg/vect/pr33834_1.cc new file mode 100644 index 0000000..715ff0d --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33834_1.cc @@ -0,0 +1,50 @@ +/* { dg-do compile } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +extern double cos (double x); +extern double sin (double x); + +class bend_class +{ + double *s_A; +public: + void set_s_A (double s_A0) + { + s_A[0] = s_A0; + } +}; +class bend_set +{ + bend_class *bend_array; +public: + void set_s_A (int index, double s_A0) + { + bend_array[index].set_s_A (s_A0); + } + void compute_s (void) + { + int i, j; + double val; + double tmp[3]; + for (i = 0; i < 5; ++i) + { + val = i; + for (j = 0; j < 2; ++j) + tmp[j] = cos (val); + set_s_A (i, tmp[0]); + tmp[j] = cos (val) / sin (val); + } + } +}; +class internals +{ + bend_set bend; + void compute_s (void); +}; +void +internals::compute_s (void) +{ + bend.compute_s (); +} +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr33834_2.cc b/gcc/testsuite/g++.dg/vect/pr33834_2.cc new file mode 100644 index 0000000..1230ca3 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33834_2.cc @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -ftree-vectorize" } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +extern int sscanf (__const char *__restrict __s, + __const char *__restrict __format, ...); +unsigned char got_elevation_pattern; +struct site +{ + float antenna_pattern[361][1001]; +} +LR; +void +LoadPAT (char *filename) +{ + int x, y; + char string[255]; + float elevation, amplitude, elevation_pattern[361][1001]; + for (x = 0; filename[x] != '.' ; x++) + sscanf (string, "%f %f", &elevation, &litude); + for (y = 0; y <= 1000; y++) + { + if (got_elevation_pattern) + elevation = elevation_pattern[x][y]; + else + elevation = 1.0; + LR.antenna_pattern[x][y] = elevation; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr33835.cc b/gcc/testsuite/g++.dg/vect/pr33835.cc new file mode 100644 index 0000000..1ab4c7e --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33835.cc @@ -0,0 +1,50 @@ +/* { dg-do compile } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +extern double cos (double x); + +class bend_class +{ + double *s_A; +public: + void set_s_A (double s_A0) + { + s_A[0] = s_A0; + } +}; +class bend_set +{ + bend_class *bend_array; +public: + void set_s_A (int index, double s_A0) + { + bend_array[index].set_s_A (s_A0); + } + void compute_s (void) + { + int i, j; + double val; + double tmp[3]; + for (i = 0; i < 5; ++i) + { + val = i; + for (j = 0; j < 2; ++j) + tmp[j] = cos (val); + set_s_A (i, tmp[0]); + tmp[j] = cos (val); + } + } +}; +class internals +{ + bend_set bend; + void compute_s (void); +}; +void +internals::compute_s (void) +{ + bend.compute_s (); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c index 04257af..b91fbc0 100644 --- a/gcc/tree-vect-analyze.c +++ b/gcc/tree-vect-analyze.c @@ -482,7 +482,10 @@ vect_analyze_operations (loop_vec_info loop_vinfo) need_to_vectorize = true; } - ok = (vectorizable_type_promotion (stmt, NULL, NULL) + ok = true; + if (STMT_VINFO_RELEVANT_P (stmt_info) + || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def) + ok = (vectorizable_type_promotion (stmt, NULL, NULL) || vectorizable_type_demotion (stmt, NULL, NULL) || vectorizable_conversion (stmt, NULL, NULL, NULL) || vectorizable_operation (stmt, NULL, NULL, NULL) @@ -493,17 +496,29 @@ vect_analyze_operations (loop_vec_info loop_vinfo) || vectorizable_condition (stmt, NULL, NULL) || vectorizable_reduction (stmt, NULL, NULL)); + if (!ok) + { + if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)) + { + fprintf (vect_dump, "not vectorized: relevant stmt not "); + fprintf (vect_dump, "supported: "); + print_generic_expr (vect_dump, stmt, TDF_SLIM); + } + return false; + } + /* Stmts that are (also) "live" (i.e. - that are used out of the loop) need extra handling, except for vectorizable reductions. */ if (STMT_VINFO_LIVE_P (stmt_info) && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type) - ok |= vectorizable_live_operation (stmt, NULL, NULL); + ok = vectorizable_live_operation (stmt, NULL, NULL); if (!ok) { if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)) { - fprintf (vect_dump, "not vectorized: stmt not supported: "); + fprintf (vect_dump, "not vectorized: live stmt not "); + fprintf (vect_dump, "supported: "); print_generic_expr (vect_dump, stmt, TDF_SLIM); } return false; @@ -3250,7 +3265,8 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo) inner-loop: *(BASE+INIT). (The first location is actually BASE+INIT+OFFSET, but we add OFFSET separately later. */ tree inner_base = build_fold_indirect_ref - (fold_build2 (PLUS_EXPR, TREE_TYPE (base), base, init)); + (fold_build2 (PLUS_EXPR, + TREE_TYPE (base), base, init)); if (vect_print_dump_info (REPORT_DETAILS)) { diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index c718e07..0578239 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -2961,14 +2961,6 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt) if (STMT_SLP_TYPE (stmt_info)) return false; - /* FORNOW: not yet supported. */ - if (STMT_VINFO_LIVE_P (stmt_info)) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - /* Is STMT a vectorizable call? */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) return false; @@ -3307,14 +3299,6 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi, if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) return false; - if (STMT_VINFO_LIVE_P (stmt_info)) - { - /* FORNOW: not yet supported. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) return false; @@ -3585,14 +3569,6 @@ vectorizable_assignment (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt, if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) return false; - /* FORNOW: not yet supported. */ - if (STMT_VINFO_LIVE_P (stmt_info)) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - /* Is vectorizable assignment? */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) return false; @@ -3702,14 +3678,6 @@ vectorizable_induction (tree phi, block_stmt_iterator *bsi ATTRIBUTE_UNUSED, gcc_assert (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def); - if (STMT_VINFO_LIVE_P (stmt_info)) - { - /* FORNOW: not yet supported. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - if (TREE_CODE (phi) != PHI_NODE) return false; @@ -3791,14 +3759,6 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt, if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) return false; - /* FORNOW: not yet supported. */ - if (STMT_VINFO_LIVE_P (stmt_info)) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - /* Is STMT a vectorizable binary/unary operation? */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) return false; @@ -4088,14 +4048,6 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi, if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) return false; - /* FORNOW: not yet supported. */ - if (STMT_VINFO_LIVE_P (stmt_info)) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - /* Is STMT a vectorizable type-demotion operation? */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) return false; @@ -4249,14 +4201,6 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi, if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) return false; - /* FORNOW: not yet supported. */ - if (STMT_VINFO_LIVE_P (stmt_info)) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - /* Is STMT a vectorizable type-promotion operation? */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) return false; @@ -4629,13 +4573,6 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt, if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) return false; - if (STMT_VINFO_LIVE_P (stmt_info)) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - /* Is vectorizable store? */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) @@ -5458,14 +5395,6 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt, if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) return false; - /* FORNOW: not yet supported. */ - if (STMT_VINFO_LIVE_P (stmt_info)) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); - return false; - } - /* Is vectorizable load? */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) return false; @@ -5893,7 +5822,7 @@ vectorizable_live_operation (tree stmt, for (i = 0; i < op_type; i++) { op = TREE_OPERAND (operation, i); - if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt)) + if (op && !vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt)) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "use not simple."); |