public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8581] middle-end/101009 - fix distance vector recording
@ 2021-06-16 13:12 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-06-16 13:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:83758b7b67629ef4492a51e5a255f0070c07574a

commit r11-8581-g83758b7b67629ef4492a51e5a255f0070c07574a
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jun 11 09:33:58 2021 +0200

    middle-end/101009 - fix distance vector recording
    
    This fixes recording of distance vectors in case the DDR has just
    constant equal indexes.  In that case we expect distance vectors
    with zero distances to be recorded which is what was done when
    any distance was computed for affine indexes.
    
    2021-06-11  Richard Biener  <rguenther@suse.de>
    
            PR middle-end/101009
            * tree-data-ref.c (build_classic_dist_vector_1): Make sure
            to set *init_b to true when we encounter a constant equal
            index pair.
            (compute_affine_dependence): Also dump the actual DR_REF.
    
            * gcc.dg/torture/pr101009.c: New testcase.
    
    (cherry picked from commit 336c41dbcb21740f8964021e157bc69ca547059b)

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr101009.c | 17 +++++++++++++++++
 gcc/tree-data-ref.c                     | 10 ++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/torture/pr101009.c b/gcc/testsuite/gcc.dg/torture/pr101009.c
new file mode 100644
index 00000000000..2bbed1dfc2c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr101009.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fno-tree-sra -fno-tree-pre -ftree-loop-distribution" } */
+
+struct a {
+  unsigned b;
+  unsigned c;
+} e, *f = &e;
+int d = 1;
+int main() {
+  for (; d; d--) {
+    struct a g[] = {{2, 1}, {2, 1}};
+    *f = g[1];
+  }
+  if (e.c != 1)
+    __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index e6dd5f15bed..d04e95f7c28 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -5112,6 +5112,8 @@ build_classic_dist_vector_1 (struct data_dependence_relation *ddr,
 	  non_affine_dependence_relation (ddr);
 	  return false;
 	}
+      else
+	*init_b = true;
     }
 
   return true;
@@ -5607,9 +5609,13 @@ compute_affine_dependence (struct data_dependence_relation *ddr,
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file, "(compute_affine_dependence\n");
-      fprintf (dump_file, "  stmt_a: ");
+      fprintf (dump_file, "  ref_a: ");
+      print_generic_expr (dump_file, DR_REF (dra));
+      fprintf (dump_file, ", stmt_a: ");
       print_gimple_stmt (dump_file, DR_STMT (dra), 0, TDF_SLIM);
-      fprintf (dump_file, "  stmt_b: ");
+      fprintf (dump_file, "  ref_b: ");
+      print_generic_expr (dump_file, DR_REF (drb));
+      fprintf (dump_file, ", stmt_b: ");
       print_gimple_stmt (dump_file, DR_STMT (drb), 0, TDF_SLIM);
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-16 13:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 13:12 [gcc r11-8581] middle-end/101009 - fix distance vector recording Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).