[Mlir-commits] [llvm] [mlir] [mlir][IR] Add SymbolUserTypeInterface (PR #198435)

Jacques Pienaar llvmlistbot at llvm.org
Thu May 28 23:49:37 PDT 2026


================
@@ -476,6 +476,58 @@ raw_ostream &mlir::operator<<(raw_ostream &os,
 // SymbolTable Trait Types
 //===----------------------------------------------------------------------===//
 
+/// Collect `type` and any nested type parameters reachable from it.
+static void collectSymbolUseTypes(Type type, SetVector<Type> &types) {
+  type.walk<WalkOrder::PreOrder>([&](Type nestedType) {
+    types.insert(nestedType);
+    return WalkResult::advance();
+  });
+}
+
+/// Collect types directly owned by `op`, including nested type parameters.
+static void collectSymbolUseTypesInOpTypes(Operation *op,
----------------
jpienaar wrote:

Why not just verify as part of walking? E.g., use a SetVector still, but created in line ~560 and then you just early exit when one (not yet seen) fails rather than collecting all and then checking. This could be done similarly for Attributes there too then.

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


More information about the Mlir-commits mailing list