------- Comment #3 from rakdver at kam dot mff dot cuni dot cz 2010-07-24 20:41 ------- Subject: Re: Redundant prefetches for some loops (vectorizer produced ones too)
> > The direct reason is that prefetching could not differentiate the base > > addresses > > of the vectorized load and store (of a[i]): > > *vect_pa.6_24 > > *vect_pa.19_37 > > Here is a testcase which shows the same issue without the vectorizer (compile > -O2 -fprefetch-loop-arrays -march=amdfam10 -fno-tree-ccp -fno-tree-vrp > -fno-tree-dominator-opts): > float *f(); > float aa[1024]; > float bb[1024]; > void foo(int beta) > { > int i; > float *a = aa, *a1 = aa, *b = bb; > for(i=0; i<1024; i++) > { > *a = *a1 + beta * *b; > a++; a1++; b++; > } > } I am not sure that this issue should be addressed in the prefetching pass; as this example shows, we already have three other passes that deal with it ordinarily. Perhaps adjusting the vectorizer code generation or scheduling copy propagation after vectorizer would be better. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45021