[Mlir-commits] [mlir] [mlir][Interfaces] `CallOpInterface`: Model forwarded result + improve verification (PR #214724)

Matthias Springer llvmlistbot at llvm.org
Mon Aug 10 05:38:22 PDT 2026


================
@@ -129,6 +168,16 @@ def CallOpInterface : OpInterface<"CallOpInterface",
       /*methodBody=*/[{}], /*defaultImplementation=*/[{
         return ::mlir::call_interface_impl::resolveCallable($_op);
       }]
+    >,
+    InterfaceMethod<[{
+        Compares types across the call boundary for compatibility: the type of
+        a forwarded operand against the type of the corresponding callee
+        argument, and the type of a forwarded result against the type of the
+        corresponding callee result.
+      }],
+      "bool", "areTypesCompatible",
+      (ins "::mlir::Type":$callerType, "::mlir::Type":$calleeType),
+      /*methodBody=*/[{}], /*defaultImplementation=*/[{ return true; }]
----------------
matthias-springer wrote:

> Also why not default to callerType == calleeType ?

My implementation was inconsistent. It should be `callerType == calleeType` indeed. Just like `BranchOpInterface::areTypesCompatible` and `RegionBranchOpInterface::areTypesCompatible`. I changed it.

> Why do we need to add this method right now?

It makes the `CallOpInterface` consistent with `BranchOpInterface` / `RegionBranchOpInterface`, also reduces some duplication from the op verifiers. But it doesn't have to be part of this PR. Should I remove it?


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


More information about the Mlir-commits mailing list