Files
swift-mirror/test/SIL/Serialization/vtable_deserialization.swift
Slava Pestov 1e8ce52736 SIL: Strip [serialized] flag from functions even at -Onone
While the comment is correct to state that this won't enable any
new optimizations with -Onone, it does enable IRGen's lazy
function emission, which is important for 'reasync' functions,
which we don't want to emit at all even at -Onone.

This fixes debug stdlib builds with the new reasync versions
of the &&, || and ?? operators.
2021-04-08 01:47:27 -04:00

40 lines
2.5 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/vtable_deserialization_input.swift -emit-module-path %t/vtable_deserialization_input.swiftmodule -emit-module
// RUN: %target-swift-frontend %s -emit-sil -I %t | %FileCheck %s
// RUN: %target-swift-frontend %s -emit-sil -O -I %t | %FileCheck %s --check-prefix=OPT
import vtable_deserialization_input
// Make sure we devirtualized the call and inlined the method body.
// CHECK: function_ref @$s28vtable_deserialization_input5ClassC11firstMethodyyFZ
// OPT: function_ref @$s28vtable_deserialization_input7unknownyyF
Class.firstMethod()
// The methods should not be deserialized in the mandatory pipeline.
// CHECK-LABEL: sil @$s28vtable_deserialization_input5ClassC11firstMethodyyFZ : $@convention(method) (@thick Class.Type) -> (){{$}}
// OPT-LABEL: sil public_external @$s28vtable_deserialization_input5ClassC11firstMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
// CHECK-LABEL: sil @$s28vtable_deserialization_input5ClassC12secondMethodyyFZ : $@convention(method) (@thick Class.Type) -> (){{$}}
// OPT-LABEL: sil public_external @$s28vtable_deserialization_input5ClassC12secondMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
// CHECK-LABEL: sil @$s28vtable_deserialization_input5ClassC11thirdMethodyyFZ : $@convention(method) (@thick Class.Type) -> (){{$}}
// OPT-LABEL: sil public_external @$s28vtable_deserialization_input5ClassC11thirdMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
// Make sure we deserialized the vtable.
// CHECK: sil_vtable Class {
// CHECK-NEXT: #Class.firstMethod: (Class.Type) -> () -> () : @$s28vtable_deserialization_input5ClassC11firstMethodyyFZ
// CHECK-NEXT: #Class.secondMethod: (Class.Type) -> () -> () : @$s28vtable_deserialization_input5ClassC12secondMethodyyFZ
// CHECK-NEXT: #Class.thirdMethod: (Class.Type) -> () -> () : @$s28vtable_deserialization_input5ClassC11thirdMethodyyFZ
// CHECK-NEXT: #Class.deinit!deallocator: @$s28vtable_deserialization_input5ClassCfD
// CHECK-NEXT: }
// OPT: sil_vtable Class {
// OPT-NEXT: #Class.firstMethod: (Class.Type) -> () -> () : @$s28vtable_deserialization_input5ClassC11firstMethodyyFZ
// OPT-NEXT: #Class.secondMethod: (Class.Type) -> () -> () : @$s28vtable_deserialization_input5ClassC12secondMethodyyFZ
// OPT-NEXT: #Class.thirdMethod: (Class.Type) -> () -> () : @$s28vtable_deserialization_input5ClassC11thirdMethodyyFZ
// OPT-NEXT: #Class.deinit!deallocator: @$s28vtable_deserialization_input5ClassCfD
// OPT-NEXT: }