Commit 7de5c6a4 by Dorit Nuzman

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
parent fc629e96
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> 2007-10-22 Janis Johnson <janis187@us.ibm.com>
* doc/invoke.texi (Optimization Options): In the summary, show * doc/invoke.texi (Optimization Options): In the summary, show
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> 2007-10-22 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/pr33644.c: New test. * gcc.dg/pr33644.c: New test.
/* { 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" } } */
/* { 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, &amplitude);
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" } } */
/* { 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" } } */
...@@ -482,7 +482,10 @@ vect_analyze_operations (loop_vec_info loop_vinfo) ...@@ -482,7 +482,10 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
need_to_vectorize = true; 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_type_demotion (stmt, NULL, NULL)
|| vectorizable_conversion (stmt, NULL, NULL, NULL) || vectorizable_conversion (stmt, NULL, NULL, NULL)
|| vectorizable_operation (stmt, NULL, NULL, NULL) || vectorizable_operation (stmt, NULL, NULL, NULL)
...@@ -493,17 +496,29 @@ vect_analyze_operations (loop_vec_info loop_vinfo) ...@@ -493,17 +496,29 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
|| vectorizable_condition (stmt, NULL, NULL) || vectorizable_condition (stmt, NULL, NULL)
|| vectorizable_reduction (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) /* Stmts that are (also) "live" (i.e. - that are used out of the loop)
need extra handling, except for vectorizable reductions. */ need extra handling, except for vectorizable reductions. */
if (STMT_VINFO_LIVE_P (stmt_info) if (STMT_VINFO_LIVE_P (stmt_info)
&& STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type) && 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 (!ok)
{ {
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)) 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); print_generic_expr (vect_dump, stmt, TDF_SLIM);
} }
return false; return false;
...@@ -3250,7 +3265,8 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo) ...@@ -3250,7 +3265,8 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
inner-loop: *(BASE+INIT). (The first location is actually inner-loop: *(BASE+INIT). (The first location is actually
BASE+INIT+OFFSET, but we add OFFSET separately later. */ BASE+INIT+OFFSET, but we add OFFSET separately later. */
tree inner_base = build_fold_indirect_ref 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)) if (vect_print_dump_info (REPORT_DETAILS))
{ {
......
...@@ -2961,14 +2961,6 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt) ...@@ -2961,14 +2961,6 @@ vectorizable_call (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
if (STMT_SLP_TYPE (stmt_info)) if (STMT_SLP_TYPE (stmt_info))
return false; 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? */ /* Is STMT a vectorizable call? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false; return false;
...@@ -3307,14 +3299,6 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi, ...@@ -3307,14 +3299,6 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false; 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) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false; return false;
...@@ -3585,14 +3569,6 @@ vectorizable_assignment (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt, ...@@ -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) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false; 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? */ /* Is vectorizable assignment? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false; return false;
...@@ -3702,14 +3678,6 @@ vectorizable_induction (tree phi, block_stmt_iterator *bsi ATTRIBUTE_UNUSED, ...@@ -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); 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) if (TREE_CODE (phi) != PHI_NODE)
return false; return false;
...@@ -3791,14 +3759,6 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt, ...@@ -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) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false; 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? */ /* Is STMT a vectorizable binary/unary operation? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false; return false;
...@@ -4088,14 +4048,6 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi, ...@@ -4088,14 +4048,6 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false; 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? */ /* Is STMT a vectorizable type-demotion operation? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false; return false;
...@@ -4249,14 +4201,6 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi, ...@@ -4249,14 +4201,6 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false; 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? */ /* Is STMT a vectorizable type-promotion operation? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false; return false;
...@@ -4629,13 +4573,6 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt, ...@@ -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) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false; 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? */ /* Is vectorizable store? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
...@@ -5458,14 +5395,6 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_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) if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false; 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? */ /* Is vectorizable load? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false; return false;
...@@ -5893,7 +5822,7 @@ vectorizable_live_operation (tree stmt, ...@@ -5893,7 +5822,7 @@ vectorizable_live_operation (tree stmt,
for (i = 0; i < op_type; i++) for (i = 0; i < op_type; i++)
{ {
op = TREE_OPERAND (operation, 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)) if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "use not simple."); fprintf (vect_dump, "use not simple.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment