Files
swift-mirror/test/SILOptimizer/mandatory_inlining_generic_autoclosure.swift
Joe Groff 69e4b95fb8 SIL: Model noescape partial_applys with ownership in OSSA.
Although nonescaping closures are representationally trivial pointers to their
on-stack context, it is useful to model them as borrowing their captures, which
allows for checking correct use of move-only values across the closure, and
lets us model the lifetime dependence between a closure and its captures without
an ad-hoc web of `mark_dependence` instructions.

During ownership elimination, We eliminate copy/destroy_value instructions and
end the partial_apply's lifetime with an explicit dealloc_stack as before,
for compatibility with existing IRGen and non-OSSA aware passes.
2023-02-16 21:43:53 -08:00

14 lines
496 B
Swift

// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
@_transparent func takesGenericAutoclosure<T>(_ fn: @autoclosure () -> T) {
_ = fn()
}
// CHECK-LABEL: sil hidden @$s38mandatory_inlining_generic_autoclosure23callsGenericAutoclosureyyxlF : $@convention(thin) <T> (@in_guaranteed T) -> () {
// FIXME
// CHE/CK-NOT: function_ref @$s38mandatory_inlining_generic_autoclosure23callsGenericAutoclosureyyxlFxyXEfu_
func callsGenericAutoclosure<T>(_ t: T) {
takesGenericAutoclosure(t)
}