public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8581] middle-end/101009 - fix distance vector recording Date: Wed, 16 Jun 2021 13:12:57 +0000 (GMT) [thread overview] Message-ID: <20210616131257.4B9DD383A81C@sourceware.org> (raw) 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); }
reply other threads:[~2021-06-16 13:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210616131257.4B9DD383A81C@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).