[Mlir-commits] [mlir] [MLIR][LLVM] Add function metadata to LLVMFuncOp (PR #203018)
Akimasa Watanuki
llvmlistbot at llvm.org
Wed Aug 19 02:23:12 PDT 2026
================
@@ -135,6 +135,24 @@ bool AddressSpaceAttr::isValidPtrIntCast(
return false;
}
+//===----------------------------------------------------------------------===//
+// FunctionMetadataAttr
+//===----------------------------------------------------------------------===//
+
+LogicalResult
+FunctionMetadataAttr::verify(function_ref<InFlightDiagnostic()> emitError,
+ StringAttr metadataName, MDNodeAttr node) {
+ (void)node;
+ StringRef name = metadataName.getValue();
+ if (name.empty())
+ return emitError() << "function_metadata entry name must not be empty";
+ if (name == "dbg" || name == "prof") {
----------------
Men-cotton wrote:
Thank you for the review.
I now allow generic `prof` metadata and reserve only `dbg` because `MDNodeAttr` cannot represent the `DISubprogram` required by a function's `!dbg` attachment. `LLVMFuncOp::verify()` now allows at most one generic `prof` attachment.
Since only one metadata kind remains reserved, I kept the direct `"dbg"` comparison and added a comment.
https://github.com/llvm/llvm-project/pull/203018
More information about the Mlir-commits
mailing list