possible gcse failure: not able to eliminate redundant loads

Dale Johannesen dalej@apple.com
Wed Dec 11 14:53:00 GMT 2002


On Wednesday, December 11, 2002, at 03:24  AM, Sanjiv Kumar Gupta, 
Noida wrote:
>> void func (double *a, double *b, int i)
>> {
>>        b[2] = a[1];
>>
>>        for (i ; i < 3; i = i + 8)
>>        {
>>                a[4] = a[1];
>>
>>        }
>> }
>
>> for -O2 -fno-argument-alias, I am getting multiple loads for a[1].
>
> Oooops! I realized it just now. Basically GCC is assuming that
> a[4] and a[1] may alias, hence reloading a[1] in each loop iteration.
> sorry for the inconvenience caused.

But surely it should be smart enough to know they don't alias?
This is still a bug, possibly an important one for performance.



More information about the Gcc mailing list