xref: /llvm-project/mlir/test/IR/test-func-set-type.mlir (revision 6a99d29022169ce9175e79983c235c438b76a030)
1// RUN: mlir-opt %s -test-func-set-type -split-input-file | FileCheck %s
2
3// It's currently not possible to have an attribute with a function type due to
4// parser ambiguity. So instead we reference a function declaration to take the
5// type from.
6
7// -----
8
9// Test case: The setType call needs to erase some arg attrs.
10
11// CHECK: func private @erase_arg(f32 {test.A})
12func.func private @t(f32)
13func.func private @erase_arg(%arg0: f32 {test.A}, %arg1: f32 {test.B})
14attributes {test.set_type_from = @t}
15
16// -----
17
18// Test case: The setType call needs to erase some result attrs.
19
20// CHECK: func private @erase_result() -> (f32 {test.A})
21func.func private @t() -> (f32)
22func.func private @erase_result() -> (f32 {test.A}, f32 {test.B})
23attributes {test.set_type_from = @t}
24