[LLVMdev] A question about pointer aliasing rules in LLVM
Krzysztof Parzyszek
kparzysz at codeaurora.org
Thu Oct 25 17:32:47 PDT 2012
On 10/25/2012 5:36 PM, Dan Gohman wrote:
>
> First, yes, it is wrong for AliasAnalysis implementations to trust LLVM
> IR types, for the most part. There's nothing in LLVM IR which would
> prevent you from having two myStruct instances which overlap here,
> sharing 4 bytes. Because of that, next really could be equal to &prev.
>
> In theory, you could help this situation by using TBAA; you could give
> next and prev fields different TBAA tags to say that a store to a next
> field never stores to a prev field.
In practice this is impossible to guarantee. The only safe way of
disambiguating the two objects is to prove that the pointers are different.
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list