[Mlir-commits] [mlir] [MLIR][Tensor][Trivial] Fix test for trivial folding of tensor.insert_slice (PR #92889)

Andi Drebes llvmlistbot at llvm.org
Tue May 21 02:54:30 PDT 2024


https://github.com/andidr created https://github.com/llvm/llvm-project/pull/92889

The test in `@trivial_insert_slice` checks for the absence of `tensor.extract_slice`, although the test neither originally contains this operation before canonicalization, nor would this operation be produced. Instead, the check should ensure the absence of `tensor.insert_slice`, which should be elided by the folder.

This is likely to be a copy-and-paste error for the check above.

>From 3dc6e7c4bb3970f9a243719812384259d8b3e1c9 Mon Sep 17 00:00:00 2001
From: Andi Drebes <andi at drebesium.org>
Date: Tue, 21 May 2024 11:43:11 +0200
Subject: [PATCH] [MLIR][Tensor][Trivial] Fix test for trivial folding of
 tensor.insert_slice

The test in `@trivial_insert_slice` checks for the absence of
`tensor.extract_slice`, although the test neither originally contains
this operation before canonicalization, nor would this operation be
produced. Instead, the check should ensure the absence of
`tensor.insert_slice`, which should be elided by the folder.

This is likely to be a copy-and-paste error for the check above.
---
 mlir/test/Dialect/Tensor/canonicalize.mlir | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/test/Dialect/Tensor/canonicalize.mlir b/mlir/test/Dialect/Tensor/canonicalize.mlir
index 914e5e8b8c4b8..89259e4d47ad3 100644
--- a/mlir/test/Dialect/Tensor/canonicalize.mlir
+++ b/mlir/test/Dialect/Tensor/canonicalize.mlir
@@ -533,7 +533,7 @@ func.func @trivial_slice(%arg0 : tensor<4x6x16x32xi8>) -> tensor<4x6x16x32xi8> {
 
 // CHECK-LABEL: func @trivial_insert_slice
 //  CHECK-SAME:   %[[ARG0:.[a-z0-9A-Z_]+]]: tensor<4x6x16x32xi8>
-//   CHECK-NOT:   tensor.extract_slice
+//   CHECK-NOT:   tensor.insert_slice
 //       CHECK:   return %[[ARG0]] :  tensor<4x6x16x32xi8>
 func.func @trivial_insert_slice(%arg0 : tensor<4x6x16x32xi8>, %arg1 : tensor<4x6x16x32xi8>) -> tensor<4x6x16x32xi8> {
   %0 = tensor.insert_slice %arg0 into %arg1[0, 0, 0, 0] [4, 6, 16, 32] [1, 1, 1, 1] : tensor<4x6x16x32xi8> into tensor<4x6x16x32xi8>



More information about the Mlir-commits mailing list