On Sun, 17 Jun 2007, Revital1 Eres wrote:

> Hello,
> 
> I have one more question regarding the comment in
> tree-ssa-ccp.c file -
> 
> 
>       /* Note that for propagation purposes, we are only interested in
>          visiting statements that load the exact same memory reference
>          stored here.  Those statements will have the exact same list
>          of virtual uses, so it is enough to set the output of this
>          statement to be its first virtual definition.  */
>       *output_p = first_vdef (stmt);
> 
> I wonder if this comment is true also if the vuses are not immediate as
> in stmt no. 1 in the following example:
> 
>          1) arr[i].x = tmp1;
>          ...
>          2) arr[i].y = tmp2;
>          ...
>          3) reg1 = arr[i].x;
>          ...
>          4) arr[i].z = tmp2;
>          ...
>          5) reg2 = arr[i].x;
> 
> Is it because we are looking for the exact same memory reference (although
> not immediate) it is enough to look at only first_vdef of every store we
> encounter in our walk through the virtual def-use chain; or by looking
> only at the first vdef we could miss vuses that could have been reached
> by vdefs other than the first one?

Well, in the current code we do not walk virtual use-def chains, but make
sure all virtual operands are the same.  So the above works.  If you
walk the chains you need to make sure that all virtual operands of the
final def you are using are the same - then the above will work again.

Richard.

Reply via email to