[Mlir-commits] [mlir] Draft: [mlir][tosa] Fix unranked tosa canonicalizations crashes (PR #188188)

Hocky Yudhiono llvmlistbot at llvm.org
Tue Mar 24 19:50:56 PDT 2026


================
@@ -1553,7 +1572,9 @@ OpFoldResult CastOp::fold(FoldAdaptor adaptor) {
     return {};
 
   auto inTy = llvm::cast<ShapedType>(getInput().getType());
-  auto outTy = llvm::cast<ShapedType>(getType());
+  auto outTy = getStaticResultShapeForDenseFold(*this);
+  if (!outTy)
+    return {};
----------------
hockyy wrote:

Good idea

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


More information about the Mlir-commits mailing list