[tree-ssa] Out of SSA status and issues

Andrew MacLeod amacleod@redhat.com
Mon May 12 18:57:00 GMT 2003


On Mon, 2003-05-12 at 10:42, Andrew MacLeod wrote:

> 
> The second case occurs when a derefernce is copy propagated into a PHI
> node:
>  
>    if (T.1_5 != 0B)
>     {
> 
>       #   VUSE <(*map)_3>;
>       #   VUSE <map_4>;
>       T.2_8 = map->compact_to_partition;
>       i.3_9 = (unsigned int)i_6;
>       T.4_10 = i.3_9 * 4;
>       T.5_11 = (int *)T.4_10;
> 
>       #   (*T.6)_13 = VDEF <(*T.6)_7>;
>       T.6_12 = T.2_8 + T.5_11;
> 
>       #   VUSE <T.6_12>;
>       i_14 = (*T.6)_13
>     };
>   #   i_1 = PHI <i_6(0), (*T.6)_13(1)>;
>   #   (*T.6)_2 = PHI <(*T.6)_7(0), (*T.6)_13(1)>;
> 
>   #   (*T.7)_17 = VDEF <(*T.7)_16>;
>   #   VUSE <(*map)_3>;
>   #   VUSE <map_4>;
>      
> The value of i_14 has been propagated into the PHI node. DCE the deletes
> the stmt 
>    i_14 = (*T.6)_13
> 
> When we go to rewrite this, all we know is that its a derefernce of T.6.
> There is no VUSE now to look at to figure out what the correct pointer
> it.  The original def has it as T.6_12. The information could be found
> by looking for the def of (*T.6)_13 (which is virtual), and looking at
> the real def, which is T.6_12. I am about to try that in my hack and see
> if it works.
>

Actually, is propagating this copy a safe thing to do? 

Copy propagation simply looks at the def, and if the stmt is a copy,
copies it... So if there was a store after the definition of i_14 which
killed the memory location that T.6_12 points to, then the PHI is going
to get the wrong result...  isn't it?

ie it would look something like this hacked up example:
 
      #   (*T.6)_13 = VDEF <(*T.6)_7>;
      T.6_12 = T.2_8 + T.5_11;

      #   VUSE <T.6_12>;
      i_14 = (*T.6)_13

      #   (*T.6)_22 = VDEF <(*T.6)_13>      
      #   VUSE <T.6_12>
      *T.6 = 30;
    };
  #   i_1 = PHI <i_6(0), (*T.6)_13(1)>;

Or is there a reason that copyprop would never happen?
Should we never copyprop an indirect reference?

Andrew



More information about the Gcc mailing list