Files
swift-mirror/test/SILOptimizer/simplify_begin_apply.sil
Erik Eckstein 3243f87204 tests: remove the lit feature swift_in_compiler
Tests require the compiler built with SwiftCompilerSources since a long time.
So this lit feature was redundant anyway. We can remove it.
2026-06-30 14:47:56 +02:00

36 lines
996 B
Plaintext

// RUN: %target-sil-opt -enable-sil-verify-all %s -onone-simplification -simplify-instruction=begin_apply | %FileCheck %s
sil_stage canonical
import Builtin
import Swift
import SwiftShims
class Bar {
init()
@_borrowed @_hasStorage var field: Int { get set }
}
// CHECK-LABEL: sil @devirt_class_method :
// CHECK: [[F:%.*]] = function_ref @bar_field_read
// CHECK: begin_apply [[F]]
// CHECK: } // end sil function 'devirt_class_method'
sil @devirt_class_method : $@convention(thin) () -> (Int, @error any Error) {
bb0:
%0 = alloc_ref $Bar
%1 = class_method %0 : $Bar, #Bar.field!read : (Bar) -> () -> (), $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int
(%2, %3) = begin_apply %1(%0) : $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int
end_apply %3 as $()
return %2 : $Int
}
sil @bar_field_read : $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int
sil_vtable Bar {
#Bar.field!read: @bar_field_read
}