[PATCH] D66461: [CaptureTracker] Comparisons of allocation pointers do not capture

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 21:53:41 PDT 2019


jdoerfert created this revision.
jdoerfert added reviewers: sanjoy, hfinkel, aykevl, xbolva00, reames, fhahn, efriedma.
Herald added subscribers: bollu, hiraditya.
Herald added a project: LLVM.

If two pointers compared in an ICmp instruction are both the result
of an allocation, or pointing into/to the end of an allocation, hence:

- dereferenceable pointers,
- noalias return pointers, (including the unique value potentiall resulting from a malloc(0) call)
- null, (if null is not a valid pointer)

then there are no "bit-tricks" possible to learn about the pointer
bits. Put differently, one cannot learn about a pointer in these
category because one cannot manipulate the other pointer freely while
keeping it in these categories. So the "other pointer" is either
"fixed" (null or something and special returned by malloc(0)) or for
the most part not controllable, e.g., the "random" allocation location
(alloc, malloc, etc.) which only allows manipulation of a few bits up
to the (log of the) allocation size.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66461

Files:
  llvm/include/llvm/Analysis/CaptureTracking.h
  llvm/lib/Analysis/CaptureTracking.cpp
  llvm/lib/Analysis/Loads.cpp
  llvm/lib/IR/Value.cpp
  llvm/test/Analysis/ValueTracking/memory-dereferenceable.ll
  llvm/test/Transforms/FunctionAttrs/nocapture.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66461.216054.patch
Type: text/x-patch
Size: 10049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/f559de83/attachment.bin>


More information about the llvm-commits mailing list