This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Serious performance regression -- some tree optimizer questions


Hello,

> > Note that in fact all the optmizations you mention boil down to
> > selecting a set of bivs that should be used inside the loop.
> 
> Basic strength reduction doesn't.
> It is simply replacement of stronger (more expensive) operations like
> multiply with weaker ones like addition.
> I don't see why we need such an expensive pass like ivopts simply to do
> strength reduction.

ivopts used for this would not be expensive (certainly not more than
a separate strength reduction pass).  The expensive part of ivopts
is selection of the bivs and optimizations to perform.  In case you
want to perform just strength reduction, you don't need this part.

> > Note that you of course can ask just for some of the possible
> > optimizations to be performed.  You do not want strength reduction
> > of array references?  OK, just tell ivopts that uses inside
> > ARRAY_REF are just generic iv uses, without telling it that it might
> > be able to strength reduce them.
> 
> I tried this once, and ivopts broke.

I have sent you the patch in my previous mail; I did not see anything
broken.

> > > >>There are plenty of things that would benefit from rerunning strength
> > > >>reduction without rerunning ivopts.
> > > >
> > > >Like what?
> > > 
> > > Linear loop transforms, vectorization, various other high level loop 
> > > transforms.
> > 
> > What exactly you mean by strength reduction -- could you please provide
> > a concrete example?  So far I thought that both Linear loop transforms
> > and vectorization want loops with a single canonical iv, i.e. the exact
> > oposite of strength reduction.
> 
> I meant after they run, hence, rerunning.
> 
> This is because they may introduce large numbers multiplies that can be
> reduced to addition in the loops.

Right.  And why would we need to get rid of them more than once?
Running ivopts just as the last of the loop optimizations seems
perfectly fine.

Note that if you really need to do just strength reduction, it is some 200
lines patch for ivopts (and there should be no performance problems,
as explained above).

> > > >>Also, things like iv selection seem very complex tasks, and as such,
> > > >>probably deserve their own passes rather than being lumped in with
> > > >>strength reduction.
> > > >
> > > >??? You cannot possibly select right ivs without taking strength
> > > >reduction and other iv related optimizations into account
> > > >
> > > >>They also shouldn't be interfering with passes that
> > > >>work faster or better with a single canonical iv (which includes linear
> > > >>loop transforms, and other loop transforms currnetly in progress)
> > > >
> > > >They should obviously be performed before ivopts, so there is no
> > > >interference (ivopts may be easily used for the "single canonical iv" 
> > > >creation,
> > > >if needed).
> > > 
> > > Without it doing strength reduction (which i don't want to happen till 
> > > later, since it removes array references and whatnot)?
> > 
> > Yes.  If you need it, I may send you a patch in a few minutes.
> Does the patch you sent do that?

Yes.

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]