[LLVMdev] BasicAliasAnalysis: Null pointers do not alias with anything
Chris Lattner
clattner at apple.com
Wed Nov 4 08:33:54 PST 2009
On Nov 4, 2009, at 7:19 AM, Daniel Berlin wrote:
> On Wed, Nov 4, 2009 at 4:51 AM, Hans Wennborg <hans at hanshq.net> wrote:
>
>>
>>
>> The reason is that it is unsure whether the null pointer which is
>> passed in
>> the call to @foo may alias with %t. Obviously, a null pointer
>> doesn't alias
>> with anything, because it's not legal to read or write through it
>> (right?).
>
> I don't remember whether LLVM's language spec says anything different,
> but whether null may alias anything is generally platform dependent.
>
> On some platforms, null may actually point to things and be
> dereferenced legally.
>
> (This is often used to speculatively executive conditionals involving
> pointer-derefs)
Our current policy is to disallow dereferences of the null pointer,
unless they are in the non-default address space.
-Chris
More information about the llvm-dev
mailing list