Page MenuHomePhabricator

[ptr_provenance] Add llvm-c support.
AcceptedPublic

Authored by jeroen.dobbelaere on Oct 13 2021, 11:41 AM.

Details

Summary

This introduces LLVMExperimentalGetPtrProvenanceOperand and LLVMExperimentalSetPtrProvenanceOperand. They can be used to get/set/remove the ptr_provenance operand of a load or store instruction.

Diff Detail

Event Timeline

jeroen.dobbelaere requested review of this revision.Oct 13 2021, 11:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2021, 11:41 AM
deadalnix requested changes to this revision.Oct 14 2021, 6:48 AM
deadalnix added inline comments.
llvm/tools/llvm-c-test/echo.cpp
633

You need to clone the values, just like it is done for the Ptr one.

First, it ensures that the value is generated properly, but second, these value belong to different (even though identical if the test passes) modules. This is not expected to work and kind of is a miracle that this doesn't crash.

644

dito

This revision now requires changes to proceed.Oct 14 2021, 6:48 AM
jeroen.dobbelaere edited the summary of this revision. (Show Details)

Fixed test crash issue as suggested by @deadalnix

jeroen.dobbelaere marked an inline comment as done.

Actual fixed version.

jeroen.dobbelaere marked an inline comment as done.Oct 14 2021, 9:18 AM
deadalnix accepted this revision.Oct 14 2021, 1:17 PM

I think using nullptr would be preferable, but this looks good. Thanks.

llvm/lib/IR/Core.cpp
3835

I missed this on the first pass, but this is a C++ file, so you can simply return nullptr.

This revision is now accepted and ready to land.Oct 14 2021, 1:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 7:03 AM