Question about RTL code hoisting

Bernd Schmidt bernds@codesourcery.com
Thu Mar 25 15:21:00 GMT 2010


On 03/25/2010 04:03 PM, Jie Zhang wrote:
> I just found that the current RTL code hoisting cannot optimize
> 
> REG = ...
> if (cond)
>   {
>     r0 = REG;
>     ....
>   }
> else
>   {
>     r0 = REG;
>     ...
>   }
> 
> to
> 
> 
> REG = ...
> r0 = REG;
> if (cond)
>   {
>     ....
>   }
> else
>   {
>     ...
>   }
> 
> where REG is a pseudo register and r0 is a physical register. I have
> looked at the code of RTL hoisting pass. But I cannot find a simple way
> to extend it to deal with this case. And the hoisting pass is only
> enabled when -Os. So I'm going to implement another hoisting pass to do
> this optimization. Is it a good idea? Does anyone know if there is an
> existing pass which should have handled or be able to be easily adapted
> to handle this case? Thanks!

Isn't this similar to crossjumping, except done in the other direction?


Bernd



More information about the Gcc mailing list