On Wed, Apr 15, 2020 at 11:23 PM Segher Boessenkool
<seg...@kernel.crashing.org> wrote:
>
> Hi!
>
> On Wed, Apr 15, 2020 at 08:21:03AM +0200, Richard Biener wrote:
> > On Wed, Apr 15, 2020 at 3:56 AM Jiufu Guo via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> > > As you may know, we have loop unroll pass in RTL which was introduced a 
> > > few
> > > years ago, and works for a long time.  Currently, this unroller is using 
> > > the
> > > pseudos in the original body, and then the pseudos are written multiple 
> > > times.
> > >
> > > It would be a good idea to create new pseudos for those duplicated 
> > > instructions
> > > during loop unrolling.  This would relax reg dependence, and then provide 
> > > more
> > > freedom/opportunity for other optimizations, like scheduling, RA...
> >
> > I think there's a separate pass to do something like this, conveniently
> > placed after unrolling.  -fweb, IIRC enabled by default for -funroll-loops
> > unless explicitly disabled.  Related is regrename which is also enabled 
> > then.
> >
> > So where does your patch make a difference?  Is the webizers dataflow 
> > analysis
> > maybe confused by backedges?
>
> Does -fweb handle things set by the last unrolled iteration, used by the
> first unrolled iteration?
>
> On a general note, we shouldn't depend on some pass that may or may not
> clean up the mess we make, when we could just avoid making a mess in the
> first place.

True - but the issue at hand is not trivial given you have to care for
partial defs, uses outside of the loop (or across the backedge), etc.
So there's plenty of things to go "wrong" here.

> The web pass belongs immediately after expand; but ideally, even expand
> would not reuse pseudos anyway.

But for example when lower-subreg decomposes things in a way turning
partial defs into full defs new opportunities to split the web arise.

> Maybe it would be better as some utility routines, not a pass?

Sure, but then when do we apply it?  Ideally scheduling would to
register renaming itself and thus not rely on the used pseudos
(I'm not sure if it tracks false dependences - I guess it must if it
isn't able to rename regs).  That would be a much better place
for improvements?

Richard.

>
> Segher

Reply via email to