> Hi,
> 
> this third patch is basically a proof-of-concept aiming at alleviating
> the following code found in Fortran functions when they look at the
> contents of array descriptors:
> 
>   <bb 2>:
>     stride.156_7 = strain_tensor_6(D)->dim[0].stride;
>     if (stride.156_7 != 0)
>       goto <bb 3>;
>     else
>       goto <bb 4>;
> 
>   <bb 3>:
> 
>   <bb 4>:
>     # stride.156_4 = PHI <stride.156_7(3), 1(2)>
> 
> and stride.156_4 is then used for other computations.  Currently we
> compute a predicate for SSA name stride.156_7 but the PHI node stops
> us from having one for stride.156_4 and those computed from it.
> 
> This patch looks at phi nodes, and if its pairs of predecessors have
> the same nearest common dominator, and the condition there is known to
> be described by a predicate (computed either by
> set_cond_stmt_execution_predicate or,
> set_switch_stmt_execution_predicate, we depend on knowing how exactly
> they behave), we use the parameter and offset from the predicate
> condition and create one for the PHI node result, provided the
> arguments of a phi node allow that, of course.

Consider:

     b==0?
    T/  \F
    /    \
   /      \
 a==0?   a==0?
T/ \F   T/  \F
... \   /   ...
     \ /
     PHI

In this case vale of PHI is determined by a==0, but the condition in common
dominator would be b==0.  We can work this out from control dependency relation
or handle it by propagation engine, but perhaps it is overkill. What about
special casing (half) diamond CFG to start with?

Path is OK with that change.
Honza

Reply via email to