J.C. Pizarro wrote:
> 2007/11/3, Kenneth Zadeck wrote:
>
>> I believe that this is something new and is most likely fallout from
>> diego's reworking of the tree to rtl converter.
>>
>> To fix this will require a round of copy propagation, most likely in
>> concert with some induction variable detection, since the most
>> profitable place for this will be in loops.
>>
>> I wonder if any of this effects the rtl level induction variable
>> discovery?
>>
>>
>>> Hi, Ramana,
>>> I tried the trunk version with/without your patch. It still produces
>>> the same code as gcc4.2.2 does. In auto-inc-dec.c, the comments say
>>>
>>> *a
>>> ...
>>> a <- a + c
>>>
>>> becomes
>>>
>>> *(a += c) post
>>>
>>> But the problem is after Tree-SSA pass, there is no
>>> a <- a + c
>>> But something like
>>> a_1 <- a + c
>>>
>>> Unless the auto-inc-dec.c can reverse a_1 <- a + c to a <- a + c. I
>>> don't see this transformation is applicable in most scenarios. Any
>>> comments?
>>>
>>> Cheers,
>>> Bingfeng
>>>
>
> They need to add an algorithm post-SSA that the code reuse the variables
> converting a_j <- phi(a_i,...) to a_k <- phi(a_k,...).
>
> The algorithms of POST_INC and POST_DEC are very specific, so an above
> general algorithm is sufficient.
>
> J.C. Pizarro
>
This is a little too simple. It assumes that the tree passes did
nothing. In fact you want to try to discover what the induction
variables are and rewrite them into a canonical form that auto-inc-dec
can then pick up on.