[Mlir-commits] [mlir] [MLIR][LLVM] Share LLVM metadata attribute translation (PR #203016)

Maksim Levental llvmlistbot at llvm.org
Fri Jun 12 10:46:04 PDT 2026


================
@@ -2521,7 +2521,8 @@ def LLVM_MetadataAsValueOp
 
     * `#llvm.md_string<"...">` -> `llvm::MDString`.
     * `#llvm.md_const<...>` -> `llvm::ConstantAsMetadata`.
-    * `#llvm.md_func<@symbol>` -> `llvm::ValueAsMetadata` of a function.
+    * `#llvm.md_func<@symbol>` -> `llvm::ValueAsMetadata` of a function or
----------------
makslevental wrote:

I don't think you can actually stick arbitrary SSA values into MDNode _arbitrarily_: 

https://github.com/llvm/llvm-project/blob/fdd939dce1eb145e386dc3242661c3a73b759e4f/llvm/include/llvm/IR/Metadata.h#L182-L183

https://github.com/llvm/llvm-project/blob/fdd939dce1eb145e386dc3242661c3a73b759e4f/llvm/lib/IR/Verifier.cpp#L1149-L1150

Apparently it's only for the purposes of `dbg` intrinsics:

```llir
define void @foo() {
  %alloca = alloca i32
  call void @llvm.dbg.declare(metadata ptr %alloca, metadata !1, metadata !DIExpression())
  ret void
}
```

(news to me! source: Claude)

Anyway I hate bikeshedding but here I think `md_global_value` is actually the correct choice since we're not plumbing to `LocalAsMetadata`.

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


More information about the Mlir-commits mailing list