PR82289: Computing peeling costs for irrelevant drs
authorRichard Sandiford <richard.sandiford@linaro.org>
Fri, 22 Sep 2017 17:04:51 +0000 (17:04 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 22 Sep 2017 17:04:51 +0000 (17:04 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr82289.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c

index fdb7221..02a5b7e 100644 (file)
@@ -1,4 +1,10 @@
 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>
 
index 39838f5..54723c2 100644 (file)
@@ -1,4 +1,9 @@
 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>
 
diff --git a/gcc/testsuite/gcc.dg/vect/pr82289.c b/gcc/testsuite/gcc.dg/vect/pr82289.c
new file mode 100644 (file)
index 0000000..ae3001f
--- /dev/null
@@ -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)
+    ;
+}
index 3c57e5c..c4314a0 100644 (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)