[PATCH] D21928: Aliasing of constant pointers (inttoptr Const) for BasicAA

Andrew Zhogin via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 07:10:03 PDT 2016


andrew.zhogin created this revision.
andrew.zhogin added reviewers: hfinkel, chandlerc.
andrew.zhogin added a subscriber: llvm-commits.

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.

http://reviews.llvm.org/D21928

Files:
  lib/Analysis/BasicAliasAnalysis.cpp
  test/Analysis/BasicAA/noalias-consts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21928.62490.patch
Type: text/x-patch
Size: 3472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160701/a1c2e714/attachment.bin>


More information about the llvm-commits mailing list