| // RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -primary-file %s -emit-ir | %FileCheck %s |
| |
| // REQUIRES: CPU=x86_64 |
| |
| sil_stage canonical |
| |
| import Builtin |
| import Swift |
| |
| class A<T> { |
| } |
| sil_vtable A {} |
| |
| protocol P { |
| func operate() |
| } |
| |
| class B<T, U:P> {} |
| sil_vtable B {} |
| |
| // CHECK-LABEL: define hidden swiftcc void @thick_metatype(%swift.type*) |
| sil hidden @thick_metatype : $@convention(thin) <T> (@thick A<T>.Type) -> () { |
| bb0(%0 : $@thick A<T>.Type): |
| %2 = tuple () |
| return %2 : $() |
| } |
| |
| sil hidden_external @use_all : $@convention(thin) <T, U where T : P, U : P> () -> () |
| |
| // CHECK-LABEL: define hidden swiftcc void @class_pointer(%T11fulfillment1BC*, i8** %T.P) |
| // CHECK: [[T0:%.*]] = bitcast %T11fulfillment1BC* %0 to %swift.type** |
| // CHECK-NEXT: [[METADATA:%.*]] = load %swift.type*, %swift.type** [[T0]], align 8 |
| // CHECK: [[T0:%.*]] = bitcast %swift.type* [[METADATA]] to %swift.type** |
| // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[T0]], i64 10 |
| // CHECK-NEXT: %T = load %swift.type*, %swift.type** [[T1]], align 8 |
| // CHECK: [[T0:%.*]] = bitcast %swift.type* [[METADATA]] to %swift.type** |
| // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[T0]], i64 11 |
| // CHECK-NEXT: %U = load %swift.type*, %swift.type** [[T1]], align 8 |
| // CHECK: [[T0:%.*]] = bitcast %swift.type* [[METADATA]] to i8*** |
| // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i8**, i8*** [[T0]], i64 12 |
| // CHECK-NEXT: %U.P = load i8**, i8*** [[T1]], align 8 |
| sil hidden @class_pointer : $@convention(thin) <T, U where T : P, U : P> (@guaranteed B<T, U>) -> () { |
| bb0(%0 : $B<T, U>): |
| %f = function_ref @use_all : $@convention(thin) <T, U where T : P, U : P> () -> () |
| apply %f<T, U>() : $@convention(thin) <T, U where T : P, U : P> () -> () |
| %3 = tuple () |
| return %3 : $() |
| } |
| |
| // CHECK-LABEL: define hidden swiftcc void @test_23121786(%T11fulfillment1AC*, %T11fulfillment1AC{{.*}}*) |
| sil hidden @test_23121786 : $@convention(thin) <T> (@owned A<A<T>>, @owned A<T>) -> () { |
| bb0(%0 : $A<A<T>>, %1 : $A<T>): |
| %2 = tuple () |
| return %2 : $() |
| } |