This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Not pulling out obvious non-aliasing global from the loop
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 31 Aug 2004 09:21:04 +0200
- Subject: Re: Not pulling out obvious non-aliasing global from the loop
- References: <A4945A7C-F710-11D8-A009-00039351ED8A@physics.uc.edu> <76B15E29-FAD8-11D8-BE87-00039351ED8A@physics.uc.edu> <173B5962-FAF3-11D8-BE87-00039351ED8A@physics.uc.edu>
Hello,
> >On Aug 25, 2004, at 8:33 PM, Andrew Pinski wrote:
> >
> >>While working on a loop pass, I noticed that we were not pulling out
> >>the load
> >>from a global variable from a loop where it obviously cannot alias
> >>anything in
> >>the loop. This seems like it would hurt the vectorizer also.
> >>
> >>This example comes from bzip2:
> >>unsigned short *q;
> >>#define NOSB 10
> >>void h1(int last)
> >>{
> >> int i;
> >> for (i=0;i<last+NOSB;i++)
> >> q[i] = 0;
> >>}
> >>
> >>Tree after lim:
> >
> >
> >I looked at this again with respect to lim and found that lim was doing
> >invariant load motion because the cost was not high enough, I think
> >we need to change the cost for this case even though it increases
> >register pressure as we then can do other optimizations on the loop
> >which
> >actually decrease it and maybe even vectorize the loop.
>
> And here is the patch which I am testing to fix this.
> Is this the right approach or is something else needed?
it seems right to me.
Zdenek