possible gcse failure: not able to eliminate redundant loads

Daniel Berlin dberlin@dberlin.org
Wed Dec 11 20:03:00 GMT 2002


On Wednesday, December 11, 2002, at 05:24  PM, Dale Johannesen wrote:

>
> 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?
It depends on what it looks like at the RTL level.
> This is still a bug, possibly an important one for performance.

Store motion can't handle this right now.
It was built to handle a certain special case.
Improve it so it does more.
It's not broken, just not as good as it could be.
--Dan



More information about the Gcc mailing list