From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26358 invoked by alias); 24 Jul 2010 20:42:08 -0000 Received: (qmail 26326 invoked by alias); 24 Jul 2010 20:41:58 -0000 Date: Sat, 24 Jul 2010 20:42:00 -0000 Message-ID: <20100724204158.26325.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/45021] Redundant prefetches for some loops (vectorizer produced ones too) In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rakdver at kam dot mff dot cuni dot cz" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg02706.txt.bz2 ------- 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