|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-frontend -emit-module -enable-library-evolution -emit-module-path=%t/P.swiftmodule -module-name=P %S/../Inputs/resilient_protocol.swift |
| 3 | +// RUN: %target-swift-frontend -module-name A -I %t -enable-profiling-marker-thunks -emit-ir %s | %FileCheck %s |
| 4 | +// RUN: %target-swift-frontend -module-name A -I %t -enable-library-evolution -enable-profiling-marker-thunks -emit-ir %s | %FileCheck %s |
| 5 | +// RUN: %target-swift-frontend -module-name A -I %t -enable-profiling-marker-thunks -emit-ir %s | %FileCheck %s --check-prefix=ATTRIBUTE |
| 6 | +// RUN: %target-swift-frontend -module-name A -I %t -disable-profiling-marker-thunks -emit-ir %s | %FileCheck %s --check-prefix=NOTHUNK |
| 7 | +// RUN: %target-swift-frontend -module-name A -I %t -emit-ir %s | %FileCheck %s --check-prefix=NOTHUNK |
| 8 | + |
| 9 | +// UNSUPPORTED: OS=windows-msvc |
| 10 | +// UNSUPPORTED: OS=linux-gnu, OS=linux-android, OS=linux-androideabi |
| 11 | + |
| 12 | +// NOTHUNK-NOT: __swift_prof_thunk |
| 13 | + |
| 14 | +import P |
| 15 | + |
| 16 | +open class GenericClass<T> { |
| 17 | + var x: T |
| 18 | + public init(_ t: T) { |
| 19 | + x = t |
| 20 | + } |
| 21 | + |
| 22 | + public func someMethod() -> Int { |
| 23 | + return 20 |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +open class PlainClass { |
| 28 | + var x: Int |
| 29 | + |
| 30 | + public init() { |
| 31 | + x = 10 |
| 32 | + } |
| 33 | + |
| 34 | + public func someMethod() -> Int { |
| 35 | + return 20 |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +public protocol SomeProto { |
| 40 | + associatedtype T |
| 41 | + |
| 42 | + func retAssoc() -> T |
| 43 | + func plain() throws |
| 44 | +} |
| 45 | + |
| 46 | +public struct Conformer<T> : SomeProto { |
| 47 | + var x : T |
| 48 | + |
| 49 | + public init( _ t: T) { |
| 50 | + self.x = t |
| 51 | + } |
| 52 | + |
| 53 | + public func retAssoc() -> T { |
| 54 | + return x |
| 55 | + } |
| 56 | + |
| 57 | + public func plain() throws { print(x) } |
| 58 | +} |
| 59 | + |
| 60 | +struct SomeGenericThing<T, V> { |
| 61 | + init(_ t: T, _ v: V) {} |
| 62 | +} |
| 63 | + |
| 64 | +public struct ResilientConformer<T> : ResilientBaseProtocol { |
| 65 | + var t : T |
| 66 | + |
| 67 | + public func requirement() -> Int { |
| 68 | + return 5 |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +public func generic<T>(_ t: T) { |
| 73 | + print(t) |
| 74 | +} |
| 75 | +public func test() { |
| 76 | + generic(SomeGenericThing(1, 3.0)) |
| 77 | +} |
| 78 | + |
| 79 | +// CHECK: @"$s1A9ConformerVyxGAA9SomeProtoAAWp" = {{.*}} @"__swift_prof_thunk__generic_witness__$s1A9ConformerVyxGAA9SomeProtoA2aEP8retAssoc1TQzyFTW" |
| 80 | +// CHECK-SAME: @"__swift_prof_thunk__generic_witness__$s1A9ConformerVyxGAA9SomeProtoA2aEP5plainyyKFTW" |
| 81 | + |
| 82 | +// CHECK: @"$s1A18ResilientConformerVyxG1P0A12BaseProtocolAAMc" = constant {{.*}} @"__swift_prof_thunk__generic_witness__$s1A18ResilientConformerVyxG1P0A12BaseProtocolAaeFP11requirementSiyFTW" |
| 83 | + |
| 84 | +// CHECK: @"$s1A12GenericClassCMn" = constant {{.*}} @"__swift_prof_thunk__generic_vtable__$s1A12GenericClassC1xxvg" |
| 85 | +// CHECK-SAME: @"__swift_prof_thunk__generic_vtable__$s1A12GenericClassC10someMethodSiyF" |
| 86 | + |
| 87 | +// CHECK: @"$s1A10PlainClassCMn" = {{.*}}@"$s1A10PlainClassC10someMethodSiyF" |
| 88 | + |
| 89 | +// CHECK: define swiftcc void @"$s1A4testyyF"() |
| 90 | +// CHECK: call swiftcc void @"__swift_prof_thunk__generic_func__2__$sSiN___$sSdN___fun__$s1A16SomeGenericThingVyACyxq_Gx_q_tcfC" |
| 91 | +// CHECK: call swiftcc void @"__swift_prof_thunk__generic_func__1__$s1A16SomeGenericThingVySiSdGN___fun__$s1A7genericyyxlF" |
| 92 | +// CHECK: ret void |
| 93 | + |
| 94 | +// CHECK: define {{.*}} swiftcc void @"__swift_prof_thunk__generic_func__1__$s1A16SomeGenericThingVySiSdGN___fun__$s1A7genericyyxlF"(ptr noalias %0, ptr %1) #[[ATTR:[0-9]+]] |
| 95 | +// CHECK: call swiftcc void @"$s1A7genericyyxlF"(ptr noalias %0, ptr %1) |
| 96 | +// CHECK: ret |
| 97 | + |
| 98 | +// CHECK: define {{.*}} void @"__swift_prof_thunk__generic_witness__$s1A9ConformerVyxGAA9SomeProtoA2aEP5plainyyKFTW"({{.*}}) #[[ATTR]] { |
| 99 | +// CHECK: define {{.*}} void @"__swift_prof_thunk__generic_vtable__$s1A12GenericClassC1xxvg"({{.*}}) #[[ATTR]] { |
| 100 | + |
| 101 | +// CHECK: attributes #[[ATTR]] = { noinline "frame-pointer"="all" |
| 102 | + |
| 103 | + |
| 104 | +// ATTRIBUTE: define {{.*}} ptr @"__swift_prof_thunk__generic_func__1__$sypN___fun__$ss27_finalizeUninitializedArrayySayxGABnlF"({{.*}}) #[[ATTR:[0-9]+]] |
| 105 | +// ATTRIBUTE: define {{.*}} void @"__swift_prof_thunk__generic_func__2__$sSiN___$sSdN___fun__$s1A16SomeGenericThingVyACyxq_Gx_q_tcfC"({{.*}}) #[[ATTR]] |
| 106 | +// ATTRIBUTE: define {{.*}} void @"__swift_prof_thunk__generic_func__1__$s1A16SomeGenericThingVySiSdGN___fun__$s1A7genericyyxlF"({{.*}}) #[[ATTR]] |
| 107 | +// ATTRIBUTE: define {{.*}} void @"__swift_prof_thunk__generic_witness__$s1A9ConformerVyxGAA9SomeProtoA2aEP8retAssoc1TQzyFTW"({{.*}}) #[[ATTR]] |
| 108 | +// ATTRIBUTE: define {{.*}} void @"__swift_prof_thunk__generic_witness__$s1A9ConformerVyxGAA9SomeProtoA2aEP5plainyyKFTW"({{.*}}) #[[ATTR]] |
| 109 | +// ATTRIBUTE: define {{.*}} i64 @"__swift_prof_thunk__generic_witness__$s1A18ResilientConformerVyxG1P0A12BaseProtocolAaeFP11requirementSiyFTW"({{.*}}) #[[ATTR]] |
| 110 | +// ATTRIBUTE: define {{.*}} void @"__swift_prof_thunk__generic_vtable__$s1A12GenericClassC1xxvg"({{.*}}) #[[ATTR]] |
| 111 | +// ATTRIBUTE: define {{.*}} void @"__swift_prof_thunk__generic_vtable__$s1A12GenericClassC1xxvs"({{.*}}) #[[ATTR]] |
| 112 | +// ATTRIBUTE: define {{.*}} ptr @"__swift_prof_thunk__generic_vtable__$s1A12GenericClassCyACyxGxcfC"({{.*}}) #[[ATTR]] |
| 113 | +// ATTRIBUTE: define {{.*}} i64 @"__swift_prof_thunk__generic_vtable__$s1A12GenericClassC10someMethodSiyF"({{.*}}) #[[ATTR]] |
| 114 | +// ATTRIBUTE: #[[ATTR]] = { noinline "frame-pointer"="all" |
0 commit comments