This patch improves BasicAA to understand aliasing of constant pointers represented as inttoptr (Const).
It supports both IntToPtrInst (%a = inttoptr i32 16 to i32*) and ConstantExpr (store i32 1, i32* inttoptr (i32 16 to i32*)) nodes.
Pointers are considered 'NoAlias' if ptr1 + size1 <= ptr2 or ptr2 + size2 <= ptr1.
Pointers are considered 'MustAlias' if ptr1 == ptr2 and size1 == size2.
Pointers are considered 'PartialAlias' otherwise.
Also, there is a check of pointer type equality.
Constant pointer is a very rare case in common application code. But for some low-level programming (drivers, embedded e.t.c.) such optimization may be helpful.
Please follow LLVM style guidelines