[Mlir-commits] [mlir] [mlir][tensor] fix out-of-bound index in tensor.dim (PR #85901)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Mar 20 01:37:32 PDT 2024


================
@@ -2367,3 +2367,25 @@ func.func @dim_of_reshape_undominated(%arg0: tensor<*xf32>, %arg1: tensor<?xinde
     %dim = tensor.dim %reshape, %0 : tensor<*xf32>
     return %dim : index
   }
+
+// -----
+
+// Test case: tensor.dim(%tensor, %out_of_bound_index) is folded into ub.poison
+// CHECK-LABEL: func @dim_out_of_bounds(
+//       CHECK: ub.poison
+//  CHECK-NEXT: bufferization.alloc_tensor
----------------
lipracer wrote:

check the `bufferization.alloc_tensor`'s operands like this:
// CHECK: %[[poison.*]]ub.poison
// CHECK-NEXT: bufferization.alloc_tensor(%[[poison]])

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


More information about the Mlir-commits mailing list