[Mlir-commits] [mlir] [MLIR] [Python] `ir.Value` is now generic in the type of the value it holds (PR #166148)

Maksim Levental llvmlistbot at llvm.org
Wed Nov 12 09:21:03 PST 2025


================
@@ -449,6 +473,11 @@ static void emitElementAccessors(
       if (!element.isVariableLength() || element.isOptional()) {
         type = std::strcmp(kind, "operand") == 0 ? "_ods_ir.Value"
                                                  : "_ods_ir.OpResult";
+        if (std::strcmp(kind, "operand") == 0) {
+          StringRef pythonType = getPythonType(element.constraint.getCppType());
+          if (!pythonType.empty())
+            type += "[" + pythonType.str() + "]";
+        }
----------------
makslevental wrote:

nit:
```suggestion
        if (std::strcmp(type, "_ods_ir.Value") == 0) {
          StringRef pythonType = getPythonType(element.constraint.getCppType());
          if (!pythonType.empty())
            type += "[" + pythonType.str() + "]";
        }
```

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


More information about the Mlir-commits mailing list