Commit 97af59b2 by Richard Biener Committed by Richard Biener

re PR tree-optimization/67109 (ICE at -O3 on x86_64-linux-gnu in…

re PR tree-optimization/67109 (ICE at -O3 on x86_64-linux-gnu in vect_analyze_slp_instance, at tree-vect-slp.c:1793)

2015-08-05  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/67109
	* tree-vect-data-refs.c (vect_analyze_group_access_1): Check
	against too big groups.  Print whether this is a load or store
	group.  Rename from ...
	(vect_analyze_group_access): ... this which is now a wrapper
	dissolving an invalid group.
	(vect_analyze_data_ref_accesses): Print whether this is a load
	or store group.

	* gcc.dg/torture/pr67109.c: New testcase.
	* gcc.dg/vect/vect-119.c: Adjust.

From-SVN: r226610
parent f980c9a2
2015-08-05 Richard Biener <rguenther@suse.de> 2015-08-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/67109
* tree-vect-data-refs.c (vect_analyze_group_access_1): Check
against too big groups. Print whether this is a load or store
group. Rename from ...
(vect_analyze_group_access): ... this which is now a wrapper
dissolving an invalid group.
(vect_analyze_data_ref_accesses): Print whether this is a load
or store group.
2015-08-05 Richard Biener <rguenther@suse.de>
PR middle-end/67107 PR middle-end/67107
* match.pd: Guard const_binop result checking against NULL_TREE * match.pd: Guard const_binop result checking against NULL_TREE
result. result.
......
2015-08-05 Richard Biener <rguenther@suse.de> 2015-08-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/67109
* gcc.dg/torture/pr67109.c: New testcase.
* gcc.dg/vect/vect-119.c: Adjust.
2015-08-05 Richard Biener <rguenther@suse.de>
PR middle-end/67107 PR middle-end/67107
* gcc.dg/pr67107.c: New testcase. * gcc.dg/pr67107.c: New testcase.
......
/* { dg-do compile } */
/* { dg-additional-options "-Wno-aggressive-loop-optimizations" } */
unsigned int a;
int b[1], c, d;
void
fn1 ()
{
for (; d;)
{
a = c = 0;
for (; c < 5; c++)
{
b[a] ^= 1;
a--;
}
}
}
...@@ -25,4 +25,4 @@ unsigned int foo (const unsigned int x[OUTER][INNER][2]) ...@@ -25,4 +25,4 @@ unsigned int foo (const unsigned int x[OUTER][INNER][2])
return sum; return sum;
} }
/* { dg-final { scan-tree-dump-times "Detected interleaving of size 2" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Detected interleaving load of size 2" 1 "vect" } } */
...@@ -2012,10 +2012,11 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo, ...@@ -2012,10 +2012,11 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo,
/* Analyze groups of accesses: check that DR belongs to a group of /* Analyze groups of accesses: check that DR belongs to a group of
accesses of legal size, step, etc. Detect gaps, single element accesses of legal size, step, etc. Detect gaps, single element
interleaving, and other special cases. Set grouped access info. interleaving, and other special cases. Set grouped access info.
Collect groups of strided stores for further use in SLP analysis. */ Collect groups of strided stores for further use in SLP analysis.
Worker for vect_analyze_group_access. */
static bool static bool
vect_analyze_group_access (struct data_reference *dr) vect_analyze_group_access_1 (struct data_reference *dr)
{ {
tree step = DR_STEP (dr); tree step = DR_STEP (dr);
tree scalar_type = TREE_TYPE (DR_REF (dr)); tree scalar_type = TREE_TYPE (DR_REF (dr));
...@@ -2182,6 +2183,14 @@ vect_analyze_group_access (struct data_reference *dr) ...@@ -2182,6 +2183,14 @@ vect_analyze_group_access (struct data_reference *dr)
if (groupsize == 0) if (groupsize == 0)
groupsize = count + gaps; groupsize = count + gaps;
if (groupsize > UINT_MAX)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"group is too large\n");
return false;
}
/* Check that the size of the interleaving is equal to count for stores, /* Check that the size of the interleaving is equal to count for stores,
i.e., that there are no gaps. */ i.e., that there are no gaps. */
if (groupsize != count if (groupsize != count
...@@ -2203,13 +2212,18 @@ vect_analyze_group_access (struct data_reference *dr) ...@@ -2203,13 +2212,18 @@ vect_analyze_group_access (struct data_reference *dr)
if (dump_enabled_p ()) if (dump_enabled_p ())
{ {
dump_printf_loc (MSG_NOTE, vect_location, dump_printf_loc (MSG_NOTE, vect_location,
"Detected interleaving of size %d starting with ", "Detected interleaving ");
(int)groupsize); if (DR_IS_READ (dr))
dump_printf (MSG_NOTE, "load ");
else
dump_printf (MSG_NOTE, "store ");
dump_printf (MSG_NOTE, "of size %u starting with ",
(unsigned)groupsize);
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
if (GROUP_GAP (vinfo_for_stmt (stmt)) != 0) if (GROUP_GAP (vinfo_for_stmt (stmt)) != 0)
dump_printf_loc (MSG_NOTE, vect_location, dump_printf_loc (MSG_NOTE, vect_location,
"There is a gap of %d elements after the group\n", "There is a gap of %u elements after the group\n",
(int)GROUP_GAP (vinfo_for_stmt (stmt))); GROUP_GAP (vinfo_for_stmt (stmt)));
} }
/* SLP: create an SLP data structure for every interleaving group of /* SLP: create an SLP data structure for every interleaving group of
...@@ -2249,6 +2263,30 @@ vect_analyze_group_access (struct data_reference *dr) ...@@ -2249,6 +2263,30 @@ vect_analyze_group_access (struct data_reference *dr)
return true; return true;
} }
/* Analyze groups of accesses: check that DR belongs to a group of
accesses of legal size, step, etc. Detect gaps, single element
interleaving, and other special cases. Set grouped access info.
Collect groups of strided stores for further use in SLP analysis. */
static bool
vect_analyze_group_access (struct data_reference *dr)
{
if (!vect_analyze_group_access_1 (dr))
{
/* Dissolve the group if present. */
gimple next, stmt = GROUP_FIRST_ELEMENT (vinfo_for_stmt (DR_STMT (dr)));
while (stmt)
{
stmt_vec_info vinfo = vinfo_for_stmt (stmt);
next = GROUP_NEXT_ELEMENT (vinfo);
GROUP_FIRST_ELEMENT (vinfo) = NULL;
GROUP_NEXT_ELEMENT (vinfo) = NULL;
stmt = next;
}
return false;
}
return true;
}
/* Analyze the access pattern of the data-reference DR. /* Analyze the access pattern of the data-reference DR.
In case of non-consecutive accesses call vect_analyze_group_access() to In case of non-consecutive accesses call vect_analyze_group_access() to
...@@ -2598,6 +2636,10 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) ...@@ -2598,6 +2636,10 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
{ {
dump_printf_loc (MSG_NOTE, vect_location, dump_printf_loc (MSG_NOTE, vect_location,
"Detected interleaving "); "Detected interleaving ");
if (DR_IS_READ (dra))
dump_printf (MSG_NOTE, "load ");
else
dump_printf (MSG_NOTE, "store ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra)); dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_NOTE, " and "); dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb)); dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb));
......
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