inlining.mlir 641 Bytes
// RUN: mlir-opt %s -inline | FileCheck %s

// These tests verify that regions with operations from Lingalg dialect
// can be inlined.

#accesses = [
  affine_map<(i) -> (i)>,
  affine_map<(i) -> (i)>
]

#trait = {
  indexing_maps = #accesses,
  iterator_types = ["parallel"]
}

func @inline_into(%arg0: memref<?xf32>) {
  // CHECK: linalg.generic
  call @inlined_fn(%arg0) : (memref<?xf32>) -> ()
  return
}

func @inlined_fn(%arg0: memref<?xf32>) {
  // CHECK: linalg.generic
  linalg.generic #trait
     ins(%arg0 : memref<?xf32>)
    outs(%arg0 : memref<?xf32>) {
    ^bb(%0 : f32, %1 : f32) :
      linalg.yield %0 : f32
  }
  return
}