PR82289: Computing peeling costs for irrelevant drs

This PR shows that we weren't filtering out irrelevant stmts in
vect_get_peeling_costs_all_drs (unlike related loops in which
we iterate over all datarefs).

2017-09-22  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	PR tree-optimization/82289
	* tree-vect-data-refs.c (vect_get_peeling_costs_all_drs): Check
	STMT_VINFO_RELEVANT_P.

gcc/testsuite/
	PR tree-optimization/82289
	* gcc.dg/vect/pr82289.c: New test.

From-SVN: r253103
This commit is contained in:
Richard Sandiford 2017-09-22 17:04:51 +00:00 committed by Richard Sandiford
parent 597fdf45ed
commit ea44495d10
4 changed files with 42 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/82289
* tree-vect-data-refs.c (vect_get_peeling_costs_all_drs): Check
STMT_VINFO_RELEVANT_P.
2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>

View file

@ -1,3 +1,8 @@
2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/82289
* gcc.dg/vect/pr82289.c: New test.
2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>

View file

@ -0,0 +1,28 @@
/* { dg-do compile } */
int a, b, c, *d, *f[1];
void fn1 (int *j)
{
int e, g, h = 1;
for (; e; e++)
{
if (g > 0)
{
d = j;
return;
}
if (!h)
while (g)
;
while (h < 1)
if (a)
{
fn1 (&h);
h = 0;
}
f[e] = &c;
}
while (1)
;
}

View file

@ -1326,6 +1326,9 @@ vect_get_peeling_costs_all_drs (vec<data_reference_p> datarefs,
{
gimple *stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
if (!STMT_VINFO_RELEVANT_P (stmt_info))
continue;
/* For interleaving, only the alignment of the first access
matters. */
if (STMT_VINFO_GROUPED_ACCESS (stmt_info)