brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 622cdc8 Raw
70 lines · plain
1// RUN: mlir-opt %s -async-runtime-ref-counting-opt | FileCheck %s2 3func.func private @consume_token(%arg0: !async.token)4 5// CHECK-LABEL: @cancellable_operations_06func.func @cancellable_operations_0(%arg0: !async.token) {7  // CHECK-NOT: async.runtime.add_ref8  // CHECK-NOT: async.runtime.drop_ref9  async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token10  async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token11  // CHECK: return12  return13}14 15// CHECK-LABEL: @cancellable_operations_116func.func @cancellable_operations_1(%arg0: !async.token) {17  // CHECK-NOT: async.runtime.add_ref18  async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token19  // CHECK: call @consume_toke20  call @consume_token(%arg0): (!async.token) -> ()21  // CHECK-NOT: async.runtime.drop_ref22  async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token23  // CHECK: return24  return25}26 27// CHECK-LABEL: @cancellable_operations_228func.func @cancellable_operations_2(%arg0: !async.token) {29  // CHECK: async.runtime.await30  // CHECK-NEXT: async.runtime.await31  // CHECK-NEXT: async.runtime.await32  // CHECK-NEXT: return33  async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token34  async.runtime.await %arg0 : !async.token35  async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token36  async.runtime.await %arg0 : !async.token37  async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token38  async.runtime.await %arg0 : !async.token39  async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token40  return41}42 43// CHECK-LABEL: @cancellable_operations_344func.func @cancellable_operations_3(%arg0: !async.token) {45  // CHECK-NOT: add_ref46  async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token47  // CHECK: call @consume_toke48  call @consume_token(%arg0): (!async.token) -> ()49  // CHECK-NOT: async.runtime.drop_ref50  async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token51  // CHECK: async.runtime.await52  async.runtime.await %arg0 : !async.token53  // CHECK: return54  return55}56 57// CHECK-LABEL: @not_cancellable_operations_058func.func @not_cancellable_operations_0(%arg0: !async.token) {59  // CHECK: add_ref60  async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token61  // CHECK: call @consume_toke62  call @consume_token(%arg0): (!async.token) -> ()63  // CHECK: async.runtime.await64  async.runtime.await %arg0 : !async.token65  // CHECK: async.runtime.drop_ref66  async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token67  // CHECK: return68  return69}70