[Mlir-commits] [mlir] [MLIR][MemRefToLLVM] Fix crash in MemorySpaceCastOpLowering when type conversion fails (PR #186404)

Mehdi Amini llvmlistbot at llvm.org
Fri Mar 13 08:34:30 PDT 2026


================
@@ -1255,8 +1255,10 @@ struct MemorySpaceCastOpLowering
 
     Type resultType = op.getDest().getType();
     if (auto resultTypeR = dyn_cast<MemRefType>(resultType)) {
-      auto resultDescType =
-          cast<LLVM::LLVMStructType>(typeConverter->convertType(resultTypeR));
+      Type convertedType = typeConverter->convertType(resultTypeR);
----------------
joker-eph wrote:

One would not crash, but silently ignore a misconfigured type converter, the other would assert with the misconfigured type converter.

I looked at the rest of the file, and the pattern is to use dyn_cast, so I aligned here!

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


More information about the Mlir-commits mailing list