diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp --- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp +++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp @@ -101,6 +101,9 @@ //===----------------------------------------------------------------------===// static bool hasZeroDimension(ShapedType shapedType) { + if (!shapedType.hasRank()) + return false; + auto rank = shapedType.getRank(); for (int i = 0; i < rank; i++) {