[rfc] Remove redundant prefetch instructions in the unroller
Andrew Pinski
pinskia@physics.uc.edu
Thu Aug 4 22:18:00 GMT 2005
On Aug 4, 2005, at 6:04 PM, Steven Bosscher wrote:
> Hi,
>
> The loop unroller will duplicate prefetches without complaints while
> unrolling a loop, but these duplicates do more harm than good. With
> the attached patch the unroller purges all prefetch instructions in
> duplicated basic blocks. Would such a patch still be appropriate at
> this stage for mainline? Bootstrapped it on x86_64-unknown-linux-gnu
> but I haven't tested it yet.
This seems like it will not work if the prefetch is way after/before
the memory location:
for (int i =0; i<1024;i++)
{
__builtin_prefetch(array[(i+4)*1024]);
__builtin_prefetch(array[(i+4)*1024+256]);
__builtin_prefetch(array[(i+4)*1024+512]);
__builtin_prefetch(array[(i+4)*1024+512+256]);
__builtin_prefetch(array[(i+4)*1024+1023]);
array[i*1024] = 0;
array[i*1024+512] = i;
array[i*1024+1023] = 1024 - i;
array[i*1024+256] = i/2;
array[i*1024+256+512] = i/2;
}
More information about the Gcc-patches
mailing list