[Mlir-commits] [mlir] 9602aa4 - [mlir][tosa] fix crash when querying the rank of an unranked tensor.

Peiming Liu llvmlistbot at llvm.org
Mon Jul 10 18:06:31 PDT 2023


Author: Peiming Liu
Date: 2023-07-11T01:06:26Z
New Revision: 9602aa472be55488eb9b5673ef92c43b79802c3c

URL: https://github.com/llvm/llvm-project/commit/9602aa472be55488eb9b5673ef92c43b79802c3c
DIFF: https://github.com/llvm/llvm-project/commit/9602aa472be55488eb9b5673ef92c43b79802c3c.diff

LOG: [mlir][tosa] fix crash when querying the rank of an unranked tensor.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D154912

Added: 
    

Modified: 
    mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 563af3ed08c120..7577c5893c775b 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -101,6 +101,9 @@ Operation *TosaDialect::materializeConstant(OpBuilder &builder, Attribute value,
 //===----------------------------------------------------------------------===//
 
 static bool hasZeroDimension(ShapedType shapedType) {
+  if (!shapedType.hasRank())
+    return false;
+
   auto rank = shapedType.getRank();
 
   for (int i = 0; i < rank; i++) {


        


More information about the Mlir-commits mailing list