[llvm] [IR] Introduce !captures metadata (PR #160913)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 09:07:11 PDT 2025


================
@@ -3025,6 +3025,9 @@ static void combineMetadata(Instruction *K, const Instruction *J,
         // Preserve !nosanitize if both K and J have it.
         K->setMetadata(Kind, JMD);
         break;
+      case LLVMContext::MD_captures:
+        K->setMetadata(Kind, JMD ? MDNode::concatenate(JMD, KMD) : nullptr);
----------------
dtcxzyw wrote:

`address_is_null + address` can be `address`. It may be better to add a `StoreInst::setCaptureComponents` helper to update MD nodes. Then we can guarantee the list is always canonical.


https://github.com/llvm/llvm-project/pull/160913


More information about the llvm-commits mailing list