From ea44495d106582b951de1e84d9d7849d3783a56d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 22 Sep 2017 17:04:51 +0000 Subject: [PATCH] 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 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 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr82289.c | 28 ++++++++++++++++++++++++++++ gcc/tree-vect-data-refs.c | 3 +++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr82289.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fdb7221848c..02a5b7eb26d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-22 Richard Sandiford + + 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 Alan Hayward David Sherwood diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 39838f595fb..54723c2c71b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-22 Richard Sandiford + + PR tree-optimization/82289 + * gcc.dg/vect/pr82289.c: New test. + 2017-09-22 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/testsuite/gcc.dg/vect/pr82289.c b/gcc/testsuite/gcc.dg/vect/pr82289.c new file mode 100644 index 00000000000..ae3001f306f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr82289.c @@ -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) + ; +} diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 3c57e5c0be0..c4314a0e2d8 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1326,6 +1326,9 @@ vect_get_peeling_costs_all_drs (vec 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) -- 2.30.2