Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions test/IRGen/async/run-thintothick-int64-to-void.sil
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(PrintShims)) %S/../../Inputs/print-shims.swift -module-name PrintShims -emit-module -emit-module-path %t/PrintShims.swiftmodule
// RUN: %target-codesign %t/%target-library-name(PrintShims)
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency -parse-sil %s -emit-ir -I %t -L %t -lPrintShim | %FileCheck %s --check-prefix=CHECK-LL
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency -parse-sil %s -module-name main -o %t/main -I %t -L %t -lPrintShims %target-rpath(%t)
// RUN: %target-codesign %t/main
// RUN: %target-run %t/main %t/%target-library-name(PrintShims) | %FileCheck %s

// REQUIRES: executable_test
// REQUIRES: swift_test_mode_optimize_none
// REQUIRES: concurrency
// UNSUPPORTED: use_os_stdlib

import Builtin
import Swift
import PrintShims
import _Concurrency

sil public_external @printInt64 : $@convention(thin) (Int64) -> ()

// CHECK-LL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @afun2(%swift.task* {{%[0-9]+}}, %swift.executor* {{%[0-9]+}}, %swift.context* {{%[0-9]+}}) {{#[0-9]*}} {
sil @afun2 : $@async @convention(thin) (Int64) -> () {
entry(%int : $Int64):
%print = function_ref @printInt64 : $@convention(thin) (Int64) -> ()
%result = apply %print(%int) : $@convention(thin) (Int64) -> () // CHECK: 9999
return %result : $()
}

// CHECK-LL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @test_apply_of_thin_to_thick(%swift.task* {{%[0-9]+}}, %swift.executor* {{%[0-9]+}}, %swift.context* {{%[0-9]+}}) {{#[0-9]*}} {
sil @test_apply_of_thin_to_thick : $@async @convention(thin) () -> () {
entry:
%f = function_ref @afun2 : $@async @convention(thin) (Int64) -> ()
%c = thin_to_thick_function %f : $@async @convention(thin) (Int64) -> () to $@async @callee_guaranteed (Int64) -> ()
%int_literal = integer_literal $Builtin.Int64, 9999
%int = struct $Int64 (%int_literal : $Builtin.Int64)
%app = apply %c(%int) : $@async @callee_guaranteed (Int64) -> ()
%result = tuple()
return %result : $()
}

sil @main : $@async @convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
bb0(%argc : $Int32, %argv : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
%test_apply_of_thin_to_thick = function_ref @test_apply_of_thin_to_thick : $@async @convention(thin) () -> ()
%result = apply %test_apply_of_thin_to_thick() : $@async @convention(thin) () -> ()

%out_literal = integer_literal $Builtin.Int32, 0
%out = struct $Int32 (%out_literal : $Builtin.Int32)
return %out : $Int32
}