[Mlir-commits] [mlir] [MLIR][LLVM] Add function metadata to LLVMFuncOp (PR #203018)

Tobias Gysi llvmlistbot at llvm.org
Wed Aug 19 11:52:28 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") {
----------------
gysit wrote:

Oh, after seeing the new code I realize the old variant was actually better under the assumption that `prof` and `dbg` are the only metadata kinds that have a explicit representation on function op?

Sorry for the confusing review. I as more thinking about just dropping the verifier, not about adding a new function verifier. But I guess dropping the verifier may result in issues when lowering back to LLVM IR?

I would thus kindly ask to go back to the verifier you had before maybe using the implementation I suggested above - if it works - to avoid the hardcoded "prof" and "dbg" strings. 






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


More information about the Mlir-commits mailing list