<div dir="ltr">This is Dimpal from NIT Calicut. I am currently
implementing Simple GVN algorithm given by Nabizath Saleena and Vineeth
Paleri [<a href="https://arxiv.org/abs/1303.1880" target="_blank">https://arxiv.org/abs/1303.<wbr>1880</a>] in LLVM.<br><div>Our aim is to preserve semantics of the program by taking any conservative assumptions. <br></div>For
example, in case of call instruction we made a conservative assumption
that after the call Expression Pool is made empty. So, we may miss some
redundancies but there will be no harm to the semantics of program.<br>But
we found that in case of pointers semantics is not preserved. If we
assign pointer to some variable than it is putting pointer and variable
in the same class so, whenever change in variable occurs using pointer
it is not behaving as per semantics.<br>For example, if we have this c program,<div><br></div><div>int *p, c=2; <br>p = &c;<br>*p = 1;</div><div><br></div><div>then my code will find the Pools given below after every instruction.<br></div><div><br>store i32 2, i32* %c, align 4<br>{ [ c : c , 2 ] }<br><br>store i32* %c, i32** %p, align 8<br>{ [ c : c , 2 , p ] }<br></div><div><br></div><div>%tmp = load i32*, i32** %p, align 8<br>{ [ c : c , 2 , p , tmp ] }<br></div><div><br></div><div>store i32 1, i32* %tmp, align 4<br>{ [ c : c , 2 , p ] ,[ tmp : tmp , 1 ] }<br></div><div><br></div><div><br></div><div>As,
we can see in above code that, we wanted to change the value of c but
it's not behaving in that way. It is treating pointer and variable in
the same way. So, Could you please help me in finding the "easiest way"
to deal with pointers with consideration of conservativeness?</div><div><br></div>Your response will be appreciated. <br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Thanks and Regards,<br></div>Dimpal Gurabani<br></div></div>
</div>