[Mlir-commits] [mlir] [mlir][func] Refactor FuncToLLVM discardable attributes algorithm (PR #188232)

Hocky Yudhiono llvmlistbot at llvm.org
Tue Mar 24 05:27:56 PDT 2026


================
@@ -280,6 +280,16 @@ FuncOp FuncOp::clone() {
   return clone(mapper);
 }
 
+/// TODO: Should we add some exception for attributes that are not
+/// dialect-prefixed?
+LogicalResult FuncOp::verify() {
+  for (const NamedAttribute &attr : (*this)->getDiscardableAttrs()) {
+    if (attr.getNameDialect())
+      continue;
+  }
+  return success();
+}
----------------
hockyy wrote:

> I’m afraid that two many places rely on this permissive behavior by now that this is an unfortunate gap we’ll have a hard time closing.

> If I were to do it, I’d start probably with implementing this in the verifier as a “strict” mode that can be disabled with a flag.

Checked your discourse comments at https://discourse.llvm.org/t/confusion-regarding-llvm-linkage-attribute-should-it-be-linkage-or-llvm-linkage/89497/6. Thinking if you have anything in mine on what we should add on this verifier here.

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


More information about the Mlir-commits mailing list