xref: /llvm-project/mlir/test/Dialect/MLProgram/inlining.mlir (revision dbbdee2ea2156170062813fb3d7f2c023d65e02d)
1// RUN: mlir-opt %s -inline | FileCheck %s
2
3// Verifies that regions with operations from the ml_program dialect can
4// be inlined.
5
6ml_program.global private @global(dense<4> : tensor<4xi32>) : tensor<4xi32>
7
8// CHECK: @inline_into
9func.func @inline_into() -> tensor<4xi32> {
10  // CHECK-NOT: @inline_from
11  // CHECK: ml_program.global_load_const
12  %0 = call @inline_from() : () -> tensor<4xi32>
13  return %0 : tensor<4xi32>
14}
15
16func.func @inline_from() -> tensor<4xi32> {
17  %0 = ml_program.global_load_const @global : tensor<4xi32>
18  return %0 : tensor<4xi32>
19}
20