xref: /llvm-project/mlir/test/Dialect/Shape/arg_with_shape.mlir (revision dce13b42177565793a2031eb6f395f9508c701e0)
1// RUN: mlir-opt -outline-shape-computation -split-input-file %s 2>%t | FileCheck %s
2
3func.func @func1(%arg0: !shape.value_shape, %arg1: !shape.value_shape) -> !shape.shape {
4  %0 = shape.shape_of %arg0 : !shape.value_shape -> !shape.shape
5  %1 = shape.shape_of %arg1 : !shape.value_shape -> !shape.shape
6  %2 = shape.meet %0, %1 : !shape.shape, !shape.shape -> !shape.shape
7  return %2 : !shape.shape
8}
9// Make sure with_shape used by call not crash.
10// CHECK-LABEL:func.func @func
11func.func @func(%arg0: !shape.value_shape, %arg1: !shape.value_shape) -> !shape.shape {
12  %0 = shape.shape_of %arg0 : !shape.value_shape -> !shape.shape
13  %1 = shape.with_shape %arg1, %0 : !shape.value_shape, !shape.shape
14  %2 = call @func1(%arg0, %1) : (!shape.value_shape, !shape.value_shape) -> !shape.shape
15  return %2 : !shape.shape
16}
17