Lines Matching +full:- +full:- +full:token

1 // RUN: mlir-opt %s -async-runtime-ref-counting | FileCheck %s
3 // CHECK-LABEL: @token
4 func.func private @token() -> !async.token
6 // CHECK-LABEL: @cond
7 func.func private @cond() -> i1
9 // CHECK-LABEL: @take_token
10 func.func private @take_token(%arg0: !async.token)
12 // CHECK-LABEL: @token_arg_no_uses
13 // CHECK: %[[TOKEN:.*]]: !async.token
14 func.func @token_arg_no_uses(%arg0: !async.token) {
15 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
19 // CHECK-LABEL: @token_value_no_uses
21 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
22 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
23 %0 = async.runtime.create : !async.token
27 // CHECK-LABEL: @token_returned_no_uses
29 // CHECK: %[[TOKEN:.*]] = call @token
30 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
31 %0 = call @token() : () -> !async.token
35 // CHECK-LABEL: @token_arg_to_func
36 // CHECK: %[[TOKEN:.*]]: !async.token
37 func.func @token_arg_to_func(%arg0: !async.token) {
38 // CHECK: async.runtime.add_ref %[[TOKEN]] {count = 1 : i64} : !async.token
39 call @take_token(%arg0): (!async.token) -> ()
40 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64} : !async.token
44 // CHECK-LABEL: @token_value_to_func
46 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
47 %0 = async.runtime.create : !async.token
48 // CHECK: async.runtime.add_ref %[[TOKEN]] {count = 1 : i64} : !async.token
49 call @take_token(%0): (!async.token) -> ()
50 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
54 // CHECK-LABEL: @token_arg_cond_br_await_with_fallthough
55 // CHECK: %[[TOKEN:.*]]: !async.token
56 func.func @token_arg_cond_br_await_with_fallthough(%arg0: !async.token, %arg1: i1) {
58 // CHECK-SAME: ^[[BB1:.*]], ^[[BB2:.*]]
66 // CHECK: async.runtime.await %[[TOKEN]]
67 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
68 async.runtime.await %arg0 : !async.token
72 // CHECK-LABEL: @token_simple_return
73 func.func @token_simple_return() -> !async.token {
74 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
75 %token = async.runtime.create : !async.token
76 // CHECK: return %[[TOKEN]]
77 return %token : !async.token
80 // CHECK-LABEL: @token_coro_return
81 // CHECK-NOT: async.runtime.drop_ref
82 // CHECK-NOT: async.runtime.add_ref
83 func.func @token_coro_return() -> !async.token {
84 %token = async.runtime.create : !async.token
97 return %token : !async.token
100 // CHECK-LABEL: @token_coro_await_and_resume
101 // CHECK: %[[TOKEN:.*]]: !async.token
102 func.func @token_coro_await_and_resume(%arg0: !async.token) -> !async.token {
103 %token = async.runtime.create : !async.token
107 // CHECK: async.runtime.await_and_resume %[[TOKEN]]
108 async.runtime.await_and_resume %arg0, %hdl : !async.token
109 // CHECK-NEXT: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
118 return %token : !async.token
121 // CHECK-LABEL: @value_coro_await_and_resume
123 func.func @value_coro_await_and_resume(%arg0: !async.value<f32>) -> !async.token {
124 %token = async.runtime.create : !async.token
131 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[CLEANUP:.*]]
146 return %token : !async.token
149 // CHECK-LABEL: @outlined_async_execute
150 // CHECK: %[[TOKEN:.*]]: !async.token
151 func.func private @outlined_async_execute(%arg0: !async.token) -> !async.token {
152 %0 = async.runtime.create : !async.token
162 async.runtime.await_and_resume %arg0, %2 : !async.token
163 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
169 async.runtime.set_available %0 : !async.token
180 return %0 : !async.token
183 // CHECK-LABEL: @token_await_inside_nested_region
186 // CHECK: %[[TOKEN:.*]] = call @token()
187 %token = call @token() : () -> !async.token
190 // CHECK: async.runtime.await %[[TOKEN]]
191 async.runtime.await %token : !async.token
194 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
199 // CHECK-LABEL: @token_defined_in_the_loop
204 // CHECK: %[[TOKEN:.*]] = call @token()
205 %token = call @token() : () -> !async.token
206 // CHECK: async.runtime.await %[[TOKEN]]
207 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
208 async.runtime.await %token : !async.token
209 %0 = call @cond(): () -> (i1)
217 // CHECK-LABEL: @divergent_liveness_one_token
219 // CHECK: %[[TOKEN:.*]] = call @token()
220 %token = call @token() : () -> !async.token
225 // CHECK: async.runtime.await %[[TOKEN]]
226 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
228 async.runtime.await %token : !async.token
231 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
239 // CHECK-LABEL: @divergent_liveness_unique_predecessor
241 // CHECK: %[[TOKEN:.*]] = call @token()
242 %token = call @token() : () -> !async.token
247 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
252 // CHECK: async.runtime.await %[[TOKEN]]
253 // CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
255 async.runtime.await %token : !async.token
263 // CHECK-LABEL: @divergent_liveness_two_tokens
265 // CHECK: %[[TOKEN0:.*]] = call @token()
266 // CHECK: %[[TOKEN1:.*]] = call @token()
267 %token0 = call @token() : () -> !async.token
268 %token1 = call @token() : () -> !async.token
277 async.runtime.await %token0 : !async.token
285 async.runtime.await %token1 : !async.token