[PATCH] D59065: [BasicAA] Simplify inttoptr(and(ptrtoint(X), C)) to X, if C preserves all significant bits.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 17:54:19 PST 2019


fhahn created this revision.
fhahn added reviewers: nlopes, efriedma, asbirlea, hfinkel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Depending on the ABI alignment and the actual pointer size, some of the
most and least significant bits are not used for addressing. When used
for accessing memory, those bits have to be 0. Those unused bits can be
used to store additional information (tagged pointers) and this
additional information can be masked out using the pattern above. If
only insignificant bits are masked out, the location the pointer
references is not changed.

Does this make sense? Unfortunately I did not find anything in the
LangRef about what the 'size of a pointer' in the datalayout actually means.
This patch assumes that bits outside the maximum pointer size and ABI
alignment do not change the location the pointer points to.

This interpretation allows for better handling of AA for tagged
pointers. In any case, I intend to clarify the LangRef if it is indeed missing
information about that scenario.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59065

Files:
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/PatternMatch.h
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/test/Analysis/BasicAA/strip-nonsignificant-ptr-bits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59065.189632.patch
Type: text/x-patch
Size: 9042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190307/06c001d8/attachment.bin>


More information about the llvm-commits mailing list