[LLVMdev] A question about pointer aliasing rules in LLVM
kparzysz at codeaurora.org
Fri Oct 26 09:24:12 PDT 2012
On 10/26/2012 10:35 AM, Dan Gohman wrote:
> It may be impossible to guarantee if the input language is C (depending
> on how you interpret it).
> However, the point of LLVM's TBAA system is to let front-ends make
> statements about aliasing that are difficult or impossible to prove from
> the IR alone. Front-ends for more restrictive source languages may
> actually be able to make guarantees about how linked list pointers are
> used. LLVM's TBAA tags are a way for them to describe at least some of
> those guarantees to optimizers.
> Unless you're objecting to the fact that while LLVM says that metadata
> *may* be stripped at any time, there are no rules for when it *must* be
> stripped, and that arbitrary valid transformations can theoretically
> cause valid TBAA and other metadata to become invalid. This is true.
> This is an area where LLVM's preference for practicality over absolute
> correctness may be observed.
I was writing with the C/C++ language in mind (since that was the
language from the original post).
I didn't think of the last point you're making, but it actually does
seem like a concern. If metadata is there to provide extra information
allowing the compiler to perform otherwise unsafe optimizations, the
possibility that it may become outdates poses a real risk.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev