[PATCH] D104268: [ptr_provenance] Introduce optional ptr_provenance operand to load/store

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 14 14:53:41 PDT 2021


jeroen.dobbelaere created this revision.
jeroen.dobbelaere added reviewers: jdoerfert, nikic.
Herald added subscribers: dexonsmith, jfb, hiraditya.
jeroen.dobbelaere requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch introduces an optional `ptr_provenance` operand to `LoadInst` and the `StoreInst`.

This allows to separate the provenance of the pointer operand from the value of the pointer operand.

This is needed by the full restrict patched (D68484 <https://reviews.llvm.org/D68484>), but will be also useful to resolve problems with
optimizations that, by replacing the pointer operand with an equivalent computation, also happen to
replace its provenance. At the same time, it can speed up some alias analysis phases, as, for the
ptr_provenance path, we can skip most of the computations.

Notes:

- This patch corresponds to D68488 <https://reviews.llvm.org/D68488> from the original Full Restrict series.
- For the specification, a `null` provenance can be treated as indicating that it can correspond to any object. Question is of this is also ok for a freestanding environment. Maybe a different mechanism makes more sense ?
- For the Load and Store instructions, the absence of the ptr_provenance operand, or a value of `undef`, are an indication the we should look at the pointer operand to track the provenance.
- When cloning a load/store instruction, for historic reasons, it was chosen to not clone the ptr_provenance, but to set it to `undef` in the clone. Now that the goal has become not to just track the noalias based provenance, but the generic provenance, this might not be the best choice.


https://reviews.llvm.org/D104268

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/InstVisitor.h
  llvm/include/llvm/IR/Instructions.h
  llvm/include/llvm/IR/User.h
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/unittests/IR/IRBuilderTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104268.351998.patch
Type: text/x-patch
Size: 20860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210614/57316a12/attachment.bin>


More information about the llvm-commits mailing list