[PATCH] D107356: [Lowering] Support lowering of llvm.experimental.ptr.provenance.

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 07:54:30 PDT 2021


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

Add support for lowering the llvm.experimental.ptr.provenance.

This means following operand 0.


https://reviews.llvm.org/D107356

Files:
  llvm/lib/CodeGen/IntrinsicLowering.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/test/CodeGen/ptr_provenance.ll


Index: llvm/test/CodeGen/ptr_provenance.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/ptr_provenance.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s
+
+define i32* @test(i32* %p, i32* %p.provenance) {
+  %p.joined = call i32* @llvm.experimental.ptr.provenance.p0i32.p0i32(i32* %p, i32* %p.provenance)
+  ret i32* %p.joined
+}
+
+declare i32* @llvm.experimental.ptr.provenance.p0i32.p0i32(i32*, i32*) nounwind readnone
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6638,6 +6638,7 @@
   case Intrinsic::ptr_annotation:
   case Intrinsic::launder_invariant_group:
   case Intrinsic::strip_invariant_group:
+  case Intrinsic::experimental_ptr_provenance:
     // Drop the intrinsic, but forward the value
     setValue(&I, getValue(I.getOperand(0)));
     return;
Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
===================================================================
--- llvm/lib/CodeGen/IntrinsicLowering.cpp
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp
@@ -333,6 +333,11 @@
   case Intrinsic::var_annotation:
     break;   // Strip out these intrinsics
 
+  case Intrinsic::experimental_ptr_provenance:
+    // Drop the provenance, but forward the value
+    CI->replaceAllUsesWith(CI->getOperand(0));
+    break;
+
   case Intrinsic::memcpy: {
     Type *IntPtr = DL.getIntPtrType(Context);
     Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107356.363744.patch
Type: text/x-patch
Size: 1622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210803/90947930/attachment.bin>


More information about the llvm-commits mailing list