// RUN: mlir-opt %s -test-linalg-greedy-fusion | FileCheck %s func @f1(%A: memref, %B: memref, %C: memref, %D: memref, %E: memref) -> memref { %c1 = constant 1 : index %c0 = constant 0 : index %c4 = constant 4 : index %c3 = constant 3 : index %c2 = constant 2 : index %c40 = constant 40 : index %c30 = constant 30 : index %c20 = constant 20 : index %0 = dim %C, %c0 : memref %1 = dim %C, %c1 : memref %2 = dim %D, %c1 : memref linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) scf.for %arg5 = %c0 to %0 step %c20 { scf.for %arg6 = %c0 to %2 step %c30 { scf.for %arg7 = %c0 to %1 step %c40 { %5 = std.subview %C[%arg5, %arg7][%c20, %c40][%c1, %c1] : memref to memref %7 = std.subview %D[%arg7, %arg6][%c40, %c30][%c1, %c1]: memref to memref %8 = std.subview %E[%arg5, %arg6][%c20, %c40][%c1, %c1] : memref to memref %9 = dim %5, %c0 : memref %10 = dim %5, %c1 : memref %11 = dim %7, %c1 : memref scf.for %arg8 = %c0 to %9 step %c2 { scf.for %arg9 = %c0 to %11 step %c3 { scf.for %arg10 = %c0 to %10 step %c4 { %14 = std.subview %5[%arg8, %arg10][%c2, %c4][%c1, %c1] : memref to memref %16 = std.subview %7[%arg10, %arg9][%c4, %c3][%c1, %c1]: memref to memref %17 = std.subview %8[%arg8, %arg9][%c2, %c4][%c1, %c1] : memref to memref linalg.matmul ins(%14, %16: memref, memref) outs(%17: memref) } } } } } } return %E : memref } // CHECK-LABEL: func @f1 // CHECK: (%[[A:.*]]:{{.*}}, %[[B:.*]]:{{.*}}, %[[C:.*]]:{{.*}}, %[[D:.*]]:{{.*}}, %[[E:.*]]:{{.*}}) // CHECK: scf.for // CHECK: scf.for // CHECK: scf.for // CHECK: scf.for // CHECK: scf.for // CHECK: scf.for // CHECK: linalg.matmul // CHECK: linalg.matmul