Dimpal Gurabani via llvm-dev
2018-Jan-09 05:07 UTC
[llvm-dev] Query in implementation of Simple GVN algorithm
This is Dimpal from NIT Calicut. I am currently implementing Simple GVN algorithm given by Nabizath Saleena and Vineeth Paleri [ https://arxiv.org/abs/1303.1880] in LLVM. Our aim is to preserve semantics of the program by taking any conservative assumptions. 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. 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. For example, if we have this c program, int *p, c=2; p = &c; *p = 1; then my code will find the Pools given below after every instruction. store i32 2, i32* %c, align 4 { [ c : c , 2 ] } store i32* %c, i32** %p, align 8 { [ c : c , 2 , p ] } %tmp = load i32*, i32** %p, align 8 { [ c : c , 2 , p , tmp ] } store i32 1, i32* %tmp, align 4 { [ c : c , 2 , p ] ,[ tmp : tmp , 1 ] } 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? Your response will be appreciated. -- Thanks and Regards, Dimpal Gurabani -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180109/abaff721/attachment.html>