Branch removal

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Sep 27 10:44:46 PDT 2012


You can't replace such Phi because its data inputs come from different 
conditions (If nodes). You can only replace Phi from "diamond" shaped graphs:

    Ctrl   Bool
       \  /
        If
       /  \
IfTrue    IfFalse
      \    /
      Region D1 D2
           \/  /
            Phi

Could you give a java code example you are trying to optimize?

Regards,
Vladimir

Patrick Metzler wrote:
> Hi Vladimir,
> 
> Thanks for your reply.
> 
>>> Again, I have a question about replacing Phi nodes with CMove nodes.
>>> I managed to do this for cases where I delete the corresponding
>>> Region; but when I just replace a Phi with a CMove (without deleting
>>> the Region), early schedule fails.
>>
>> By delete you mean replace it with control edge of If node. Right? Also
>> you can't delete it if there are other Phis attached to it.
> 
> Sorry, I should have been more precise. For example, I want this:
> 
>    Ctrl   Bool
>       \  /
>        If
>       /  \                ...
> IfTrue    IfFalse        /
>           \        Iffalse
>            \      /
>             \    /
>            Region D1 D2
>             /   \/  /
>            Phi   Phi
> 
> be replaced by this:
> 
>  _____ Ctrl              ...
> |       \               /
> |        \        Iffalse
> |  Bool   \      /
> | /        \    /
> ||  D1 D2  Region
> || /  /    /
> CMove     Phi
> 
> 
> So it is not possible because there is another Phi at Region?
> 
> Best regards,
> Patrick


More information about the hotspot-compiler-dev mailing list