[Mlir-commits] [mlir] [mlir] fix Undefined behavior in CastInfo::castFailed with From=<MLIRinterface> (PR #87145)

River Riddle llvmlistbot at llvm.org
Mon Oct 28 09:53:20 PDT 2024


================
@@ -2142,6 +2143,83 @@ struct DenseMapInfo<T,
   }
   static bool isEqual(T lhs, T rhs) { return lhs == rhs; }
 };
+
+/// Add support for llvm style casts.
+/// We provide a cast between To and From if To and From is mlir::OpInterface or
+/// derives from it.
+template <typename To, typename From>
----------------
River707 wrote:

Is it important to distinguish these two cases, or could you just write one CastInfo that handles two types that both derive from `OpState`? Handling it generically like that would also remove the tablegen changes as well I would think.

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


More information about the Mlir-commits mailing list