[Mlir-commits] [mlir] [mlir][tosa] Fix unranked tosa canonicalizations crashes (PR #188188)
Luke Hutton
llvmlistbot at llvm.org
Tue Mar 24 03:24:53 PDT 2026
================
@@ -1736,8 +1757,10 @@ OpFoldResult ResizeOp::fold(FoldAdaptor adaptor) {
}
auto input = getInput();
- auto inputTy = llvm::cast<RankedTensorType>(input.getType());
- auto resultTy = llvm::cast<RankedTensorType>(getType());
+ auto inputTy = llvm::dyn_cast<RankedTensorType>(input.getType());
+ auto resultTy = llvm::dyn_cast<RankedTensorType>(getType());
+ if (!inputTy || !resultTy)
----------------
lhutton1 wrote:
I wonder if this is possible given the input should be constant and therefore have a static type, could we add a test for `resize`?
Assuming what I said above is correct, we shouldn't need to cast to a `RankedTensorType` here and can just have:
```
return foldToInputIfTypeMatches(*this, input.getType())
```
https://github.com/llvm/llvm-project/pull/188188
More information about the Mlir-commits
mailing list