This is an archive of the discontinued LLVM Phabricator instance.

[ptr_provenance] Introduce llvm.experimental.ptr.provenance
AcceptedPublic

Authored by jeroen.dobbelaere on Aug 3 2021, 7:52 AM.

Details

Summary

The llvm.experimental.ptr.provenance intrinsics combines a pointer value (=operand 0) with a pointer provenance (= operand 1).
This intrinsic is provided so that the provenance can be tracked when a pointer (with provenance) is returned, passed to a function, stored into memory.

When loading and storing through such a pointer, the intrinsic can be omited and the operand 1 can be connected to the ptr_provenance operand of the load/store instructions.

Diff Detail

Event Timeline

jeroen.dobbelaere requested review of this revision.Aug 3 2021, 7:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2021, 7:52 AM
MatzeB added a subscriber: MatzeB.Nov 3 2021, 5:13 PM

Please document in the LLVM language reference.

nikic added inline comments.Jan 24 2022, 12:44 PM
llvm/include/llvm/IR/Intrinsics.td
597

IRBuilder asserts that both types are the same, so make the second one LLVMMatchType<0> as well?

598

This can also be NoCapture<ArgIndex<1>> I believe. (The first argument is capturing, because the pointer is returned.)

Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 7:05 AM
asbirlea accepted this revision.Nov 29 2022, 10:27 AM
This revision is now accepted and ready to land.Nov 29 2022, 10:27 AM
Matt added a subscriber: Matt.Dec 8 2022, 8:28 AM
nikic added inline comments.May 24 2023, 8:47 AM
llvm/include/llvm/IR/Intrinsics.td
598

Ignore this comment -- we currently don't distinguish between address and provenance capture, so annotating it would likely not be correct.