[Mlir-commits] [mlir] [mlir][linalg] Add folder for `linalg.index` (PR #136640)

Mehdi Amini llvmlistbot at llvm.org
Tue Apr 22 06:01:29 PDT 2025


================
@@ -305,6 +305,86 @@ func.func @self_copy(%arg0 : memref<2x3x?x4xf32>) {
 }
 
 // -----
+
+// CHECK: func @fold_linalg_index_tensor_static
+func.func @fold_linalg_index_tensor_static(%0: tensor<4x16xi32>, %1: tensor<1x16xi32>,
+                                           %2: tensor<4x1xi32>) -> tensor<4x1xi32> {
+// CHECK-NEXT: linalg.generic
+// CHECK:        %[[IDX_0:.+]] = linalg.index 0 : index
+// CHECK-NOT:    linalg.index 1
----------------
joker-eph wrote:

```
// CHECK-NOT: linalg.index 1
// CHECK: %[[IDX_0:.+]] = linalg.index 0 : index
```

Wouldn't that just ensure that `linalg.index 1` does not appear before `linalg.index 0`?


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


More information about the Mlir-commits mailing list