From: Richard Biener <rguenther@suse.de>
To: Michael Matz <matz@suse.de>
Cc: gcc-patches@gcc.gnu.org, bin.cheng@linux.alibaba.com
Subject: Re: [PATCH] tree-optimization/101280 - revise interchange fix for PR101173
Date: Fri, 2 Jul 2021 08:54:09 +0200 (CEST) [thread overview]
Message-ID: <nycvar.YFH.7.76.2107020853440.9200@zhemvz.fhfr.qr> (raw)
In-Reply-To: <nycvar.YFH.7.76.2107020802300.9200@zhemvz.fhfr.qr>
On Fri, 2 Jul 2021, Richard Biener wrote:
> On Thu, 1 Jul 2021, Michael Matz wrote:
>
> > Hello,
> >
> > On Thu, 1 Jul 2021, Richard Biener wrote:
> >
> > > diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc
> > > index 43045c5455e..43ef112a2d0 100644
> > > --- a/gcc/gimple-loop-interchange.cc
> > > +++ b/gcc/gimple-loop-interchange.cc
> > > @@ -1043,8 +1043,11 @@ tree_loop_interchange::valid_data_dependences (unsigned i_idx, unsigned o_idx,
> > > continue;
> > >
> > > /* Be conservative, skip case if either direction at i_idx/o_idx
> > > - levels is not '=' (for the inner loop) or '<'. */
> > > - if (dist_vect[i_idx] < 0 || dist_vect[o_idx] <= 0)
> > > + levels is not '=' or '<'. */
> > > + if (dist_vect[i_idx] < 0
> > > + || (DDR_REVERSED_P (ddr) && dist_vect[i_idx] > 0)
> > > + || dist_vect[o_idx] < 0
> > > + || (DDR_REVERSED_P (ddr) && dist_vect[o_idx] > 0))
> >
> > Hmm, if DDR_REVERSED_P matters here, then it should matter for all arms.
> > IOW: < 0 should be tested only when !DDR_REVERSED_P, not always:
> >
> > if ((!DDR_REVERSED_P (ddr) && dist_vect[i_idx] < 0)
> > || (DDR_REVERSED_P (ddr) && dist_vect[i_idx] > 0)
> > || (!DDR_REVERSED_P (ddr) && dist_vect[o_idx] < 0)
> > || (DDR_REVERSED_P (ddr) && dist_vect[o_idx] > 0))
> >
> > (what you have effectively written is a condition that allows only 0 when
> > DDR_REVERSED_P)
>
> True - been fixing bugs too fast I guess. Maybe the 3rd time's the charm
> then ;)
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
Richard.
From 094af28137de5c55a21123c3b4e06e7d7a08bb5a Mon Sep 17 00:00:00 2001
From: Richard Biener <rguenther@suse.de>
Date: Fri, 2 Jul 2021 08:51:43 +0200
Subject: [PATCH] tree-optimization/101280 - re-revise interchange fix for
PR101173
To: gcc-patches@gcc.gnu.org
The following fixes up the revision of the original fix for PR101173
to properly guard all dependence checks with DDR_REVERSED_P or its
inverse.
2021-07-01 Richard Biener <rguenther@suse.de>
PR tree-optimization/101280
PR tree-optimization/101173
* gimple-loop-interchange.cc
(tree_loop_interchange::valid_data_dependences): Properly
guard all dependence checks with DDR_REVERSED_P or its
inverse.
---
gcc/gimple-loop-interchange.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc
index 43ef112a2d0..7a88faa2c07 100644
--- a/gcc/gimple-loop-interchange.cc
+++ b/gcc/gimple-loop-interchange.cc
@@ -1044,9 +1044,9 @@ tree_loop_interchange::valid_data_dependences (unsigned i_idx, unsigned o_idx,
/* Be conservative, skip case if either direction at i_idx/o_idx
levels is not '=' or '<'. */
- if (dist_vect[i_idx] < 0
+ if ((!DDR_REVERSED_P (ddr) && dist_vect[i_idx] < 0)
|| (DDR_REVERSED_P (ddr) && dist_vect[i_idx] > 0)
- || dist_vect[o_idx] < 0
+ || (!DDR_REVERSED_P (ddr) && dist_vect[o_idx] < 0)
|| (DDR_REVERSED_P (ddr) && dist_vect[o_idx] > 0))
return false;
}
--
2.26.2
prev parent reply other threads:[~2021-07-02 6:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 11:38 Richard Biener
2021-07-01 14:49 ` Michael Matz
2021-07-02 6:03 ` Richard Biener
2021-07-02 6:54 ` Richard Biener [this message]
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=nycvar.YFH.7.76.2107020853440.9200@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=bin.cheng@linux.alibaba.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=matz@suse.de \
/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: link
Be 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).