On 10/26/07, J.C. Pizarro <[EMAIL PROTECTED]> wrote:

> What is the matter if the 'b' var. is unused and
> optimally removed by the SSA algorithm?

In this case, it will not be removed.  If any of the p_i pointers is
ever dereferenced in this code, that will be considered a use of
variable 'b'.


> int a;
> int b;
>
> a = 2;
> p_4 = phi(a)

Is this 'phi' as in a PHI function or a function in your code?  If the
former, then it's wrong, you can never have such a phi function in
this code snippet.

> // b doesn't used here
> if (...)
>   p_1 = &a;
> else
>   p_2 = &b;
> endif
> p_3 = phi (p_1, p_2)
>
> points-to (p_1) = { a }
> points-to (p_2) = { b }
> points-to (p_3) = { a b }
>
> In this case, should exist hidden p_5 = phi(b) although 'b' is not used
> but yes used his reference to phantom cell 'b'. It's weird for me.

I recommend that you read about the SSA form.  PHI nodes are special
constructs that exist only where multiple control flow paths reach a
common join node.  The getting started section of the wiki has links
to books and articles about it.  Morgan's book on compiler
optimization is fairly good.

> I've not idea WHERE put "hidden p_5 = phi(b)"!

No such thing exists.


> Too it's possible to ocurr *p_2 = c where 'b' will be hidden used through
> the pointer p_2. It's too weird for me.

Yes, that is possible, an that is precisely what alias analysis tells
the compiler.  We know from the analysis that reading/writing to
'*p_2' is exactly the same as reading/writing to 'b'.

Reply via email to