Skip to content

Commit 3239400

Browse files
eecksteinaschwaighofer
authored andcommitted
convert some IRGen tests to opaque pointers
1 parent da52e75 commit 3239400

12 files changed

+358
-417
lines changed

test/IRGen/generic_vtable.swift

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %{python} %utils/chex.py < %s > %t/generic_vtable.swift
3-
// RUN: %target-swift-frontend %use_no_opaque_pointers -enable-objc-interop %t/generic_vtable.swift -emit-ir | %FileCheck %t/generic_vtable.swift --check-prefixes=CHECK,CHECK-objc,CHECK-objc%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-import-type,CHECK-%target-abi -DINT=i%target-ptrsize
4-
// RUN: %target-swift-frontend %use_no_opaque_pointers -disable-objc-interop %t/generic_vtable.swift -emit-ir | %FileCheck %t/generic_vtable.swift --check-prefixes=CHECK,CHECK-native,CHECK-native%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-import-type,CHECK-%target-abi -DINT=i%target-ptrsize
5-
// RUN: %target-swift-frontend -enable-objc-interop %t/generic_vtable.swift -emit-ir
6-
// RUN: %target-swift-frontend -disable-objc-interop %t/generic_vtable.swift -emit-ir
3+
// RUN: %target-swift-frontend -enable-objc-interop %t/generic_vtable.swift -emit-ir | %FileCheck %t/generic_vtable.swift --check-prefixes=CHECK,CHECK-objc,CHECK-objc%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-import-type,CHECK-%target-abi -DINT=i%target-ptrsize
4+
// RUN: %target-swift-frontend -disable-objc-interop %t/generic_vtable.swift -emit-ir | %FileCheck %t/generic_vtable.swift --check-prefixes=CHECK,CHECK-native,CHECK-native%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-import-type,CHECK-%target-abi -DINT=i%target-ptrsize
75

86
public class Base {
97
public func m1() {}
@@ -35,9 +33,9 @@ public class Concrete : Derived<Int> {
3533
// -- vtable size
3634
// CHECK-SAME: i32 3,
3735
// -- vtable entry for m1()
38-
// CHECK-SAME: void (%T14generic_vtable4BaseC*)* @"$s14generic_vtable4BaseC2m1yyF"
36+
// CHECK-SAME: ptr @"$s14generic_vtable4BaseC2m1yyF"
3937
// -- vtable entry for m2()
40-
// CHECK-SAME: void (%T14generic_vtable4BaseC*)* @"$s14generic_vtable4BaseC2m2yyF"
38+
// CHECK-SAME: ptr @"$s14generic_vtable4BaseC2m2yyF"
4139
// --
4240
// CHECK-SAME: section "{{.*}}",{{.*}} align 4
4341

@@ -47,13 +45,13 @@ public class Concrete : Derived<Int> {
4745
// -- destructor
4846
// CHECK-SAME: @"$s14generic_vtable4BaseCfD{{(.ptrauth)?}}"
4947
// -- value witness table
50-
// CHECK-SAME: i8** {{@"\$sBoWV"|null}}
48+
// CHECK-SAME: ptr {{@"\$sBoWV"|null}}
5149
// -- vtable entry for 'm1()'
52-
// CHECK-SAME: void (%T14generic_vtable4BaseC*)* {{@"\$s14generic_vtable4BaseC2m1yyF"|.* @"\$s14generic_vtable4BaseC2m1yyF.ptrauth[.0-9]*"}}
50+
// CHECK-SAME: ptr {{@"\$s14generic_vtable4BaseC2m1yyF"|@"\$s14generic_vtable4BaseC2m1yyF.ptrauth[.0-9]*"}}
5351
// -- vtable entry for 'm2()'
54-
// CHECK-SAME: void (%T14generic_vtable4BaseC*)* {{@"\$s14generic_vtable4BaseC2m2yyF"|.* @"\$s14generic_vtable4BaseC2m2yyF.ptrauth[.0-9]*"}}
52+
// CHECK-SAME: ptr {{@"\$s14generic_vtable4BaseC2m2yyF"|@"\$s14generic_vtable4BaseC2m2yyF.ptrauth[.0-9]*"}}
5553
// -- vtable entry for 'init()'
56-
// CHECK-SAME: %T14generic_vtable4BaseC* (%swift.type*)* {{@"\$s14generic_vtable4BaseCACycfC"|.* @"\$s14generic_vtable4BaseCACycfC.ptrauth[.0-9]*"}}
54+
// CHECK-SAME: ptr {{@"\$s14generic_vtable4BaseCACycfC"|@"\$s14generic_vtable4BaseCACycfC.ptrauth[.0-9]*"}}
5755
// --
5856
// CHECK-SAME: , align
5957

@@ -71,7 +69,7 @@ public class Concrete : Derived<Int> {
7169
// -- vtable size
7270
// CHECK-SAME: i32 1,
7371
// -- vtable entry for m3()
74-
// CHECK-SAME: void (%T14generic_vtable7DerivedC*)* @"$s14generic_vtable7DerivedC2m3yyF"
72+
// CHECK-SAME: ptr @"$s14generic_vtable7DerivedC2m3yyF"
7573
// -- override table size
7674
// CHECK-SAME: i32 2,
7775
// -- override for m2()
@@ -109,7 +107,7 @@ public class Concrete : Derived<Int> {
109107
// -- vtable size
110108
// CHECK-SAME: i32 1,
111109
// -- vtable entry for m4()
112-
// CHECK-SAME: void (%T14generic_vtable8ConcreteC*)* @"$s14generic_vtable8ConcreteC2m4yyF"
110+
// CHECK-SAME: ptr @"$s14generic_vtable8ConcreteC2m4yyF"
113111
// -- override table size
114112
// CHECK-SAME: i32 2,
115113
// -- override for m3()
@@ -130,59 +128,59 @@ public class Concrete : Derived<Int> {
130128
// -- destructor
131129
// CHECK-SAME: @"$s14generic_vtable8ConcreteCfD{{(.ptrauth)?}}"
132130
// -- value witness table is filled in at runtime
133-
// CHECK-SAME: i8** null,
131+
// CHECK-SAME: ptr null,
134132
// -- nominal type descriptor
135133
// CHECK-SAME: @"$s14generic_vtable8ConcreteCMn{{(.ptrauth)?}}"
136134
// -- vtable entry for 'm1()'
137-
// CHECK-SAME: void (%T14generic_vtable4BaseC*)* {{@"\$s14generic_vtable4BaseC2m1yyF"|.* @"\$s14generic_vtable4BaseC2m1yyF.ptrauth[.0-9]*"}}
135+
// CHECK-SAME: ptr {{@"\$s14generic_vtable4BaseC2m1yyF"|@"\$s14generic_vtable4BaseC2m1yyF.ptrauth[.0-9]*"}}
138136
// -- vtable entry for 'm2()'
139-
// CHECK-SAME: void (%T14generic_vtable7DerivedC*)* {{@"\$s14generic_vtable7DerivedC2m2yyF"|.* @"\$s14generic_vtable7DerivedC2m2yyF.ptrauth[.0-9]*"}}
137+
// CHECK-SAME: ptr {{@"\$s14generic_vtable7DerivedC2m2yyF"|@"\$s14generic_vtable7DerivedC2m2yyF.ptrauth[.0-9]*"}}
140138
// -- vtable entry for 'init()'
141-
// CHECK-SAME: %T14generic_vtable8ConcreteC* (%swift.type*)* {{@"\$s14generic_vtable8ConcreteCACycfC"|.* @"\$s14generic_vtable8ConcreteCACycfC.ptrauth[.0-9]*"}}
139+
// CHECK-SAME: ptr {{@"\$s14generic_vtable8ConcreteCACycfC"|@"\$s14generic_vtable8ConcreteCACycfC.ptrauth[.0-9]*"}}
142140
// -- vtable entry for 'm3()'
143-
// CHECK-SAME: void (%T14generic_vtable8ConcreteC*)* {{@"\$s14generic_vtable8ConcreteC2m3yyF"|.* @"\$s14generic_vtable8ConcreteC2m3yyF.ptrauth[.0-9]*"}}
141+
// CHECK-SAME: ptr {{@"\$s14generic_vtable8ConcreteC2m3yyF"|@"\$s14generic_vtable8ConcreteC2m3yyF.ptrauth[.0-9]*"}}
144142
// -- vtable entry for 'm4()'
145-
// CHECK-SAME: void (%T14generic_vtable8ConcreteC*)* {{@"\$s14generic_vtable8ConcreteC2m4yyF"|.* @"\$s14generic_vtable8ConcreteC2m4yyF.ptrauth[.0-9]*"}}
143+
// CHECK-SAME: ptr {{@"\$s14generic_vtable8ConcreteC2m4yyF"|@"\$s14generic_vtable8ConcreteC2m4yyF.ptrauth[.0-9]*"}}
146144
// --
147145
// CHECK-SAME: }>, align
148146

149147

150148
//// Method descriptors
151149

152-
// CHECK-LABEL: @"$s14generic_vtable4BaseC2m1yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>* @"$s14generic_vtable4BaseCMn", i32 0, i32 {{(13|16)}})
153-
// CHECK-LABEL: @"$s14generic_vtable4BaseC2m2yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}* @"$s14generic_vtable4BaseCMn", i32 0, i32 {{(14|17)}})
154-
// CHECK-LABEL: @"$s14generic_vtable4BaseCACycfCTq" = hidden alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}* @"$s14generic_vtable4BaseCMn", i32 0, i32 {{(15|18)}})
150+
// CHECK-LABEL: @"$s14generic_vtable4BaseC2m1yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>, ptr @"$s14generic_vtable4BaseCMn", i32 0, i32 {{(13|16)}})
151+
// CHECK-LABEL: @"$s14generic_vtable4BaseC2m2yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>, ptr @"$s14generic_vtable4BaseCMn", i32 0, i32 {{(14|17)}})
152+
// CHECK-LABEL: @"$s14generic_vtable4BaseCACycfCTq" = hidden alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>, ptr @"$s14generic_vtable4BaseCMn", i32 0, i32 {{(15|18)}})
155153

156-
// CHECK-LABEL: @"$s14generic_vtable7DerivedC2m3yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>* @"$s14generic_vtable7DerivedCMn", i32 0, i32 23)
154+
// CHECK-LABEL: @"$s14generic_vtable7DerivedC2m3yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>, ptr @"$s14generic_vtable7DerivedCMn", i32 0, i32 23)
157155

158-
// CHECK-LABEL: @"$s14generic_vtable8ConcreteC2m4yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>* @"$s14generic_vtable8ConcreteCMn", i32 0, i32 16)
156+
// CHECK-LABEL: @"$s14generic_vtable8ConcreteC2m4yyFTq" ={{( dllexport)?}}{{( protected)?}} alias %swift.method_descriptor, getelementptr inbounds (<{{.*}}>, ptr @"$s14generic_vtable8ConcreteCMn", i32 0, i32 16)
159157

160158

161159
//// Metadata initialization function for 'Derived' copies superclass vtable
162160
//// and installs overrides for 'm2()' and 'init()'.
163161

164-
// CHECK-LABEL: define internal %swift.type* @"$s14generic_vtable7DerivedCMi"(%swift.type_descriptor* %0, i8** %1, i8* %2)
162+
// CHECK-LABEL: define internal ptr @"$s14generic_vtable7DerivedCMi"(ptr %0, ptr %1, ptr %2)
165163

166164
// - 2 immediate members:
167165
// - type metadata for generic parameter T,
168166
// - and vtable entry for 'm3()'
169-
// CHECK: [[METADATA:%.*]] = call %swift.type* @swift_allocateGenericClassMetadata(%swift.type_descriptor* {{.*}}, i8** %1, i8* %2)
170-
// CHECK: ret %swift.type* [[METADATA]]
167+
// CHECK: [[METADATA:%.*]] = call ptr @swift_allocateGenericClassMetadata(ptr {{.*}}, ptr %1, ptr %2)
168+
// CHECK: ret ptr [[METADATA]]
171169

172170
// CHECK-LABEL: define internal swiftcc %swift.metadata_response @"$s14generic_vtable7DerivedCMr"
173-
// CHECK-SAME: (%swift.type* [[METADATA:%.*]], i8* %0, i8** %1) {{.*}} {
174-
// CHECK: call swiftcc %swift.metadata_response @swift_initClassMetadata2(%swift.type* [[METADATA]], [[INT]] 0, {{.*}})
171+
// CHECK-SAME: (ptr [[METADATA:%.*]], ptr %0, ptr %1) {{.*}} {
172+
// CHECK: call swiftcc %swift.metadata_response @swift_initClassMetadata2(ptr [[METADATA]], [[INT]] 0, {{.*}})
175173

176174
// CHECK: ret %swift.metadata_response
177175

178176

179177
// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swiftcc %swift.metadata_response @"$s14generic_vtable8ConcreteCMa"
180-
// CHECK: call swiftcc %swift.metadata_response @swift_getSingletonMetadata([[INT]] %0, %swift.type_descriptor* bitcast ({{.*}} @"$s14generic_vtable8ConcreteCMn" to {{.*}}))
178+
// CHECK: call swiftcc %swift.metadata_response @swift_getSingletonMetadata([[INT]] %0, ptr @"$s14generic_vtable8ConcreteCMn")
181179
// CHECK: ret
182180

183181
//// Metadata response function for 'Concrete' is fairly simple.
184182

185-
// CHECK-LABEL: define internal swiftcc %swift.metadata_response @"$s14generic_vtable8ConcreteCMr"(%swift.type* %0, i8* %1, i8** %2)
183+
// CHECK-LABEL: define internal swiftcc %swift.metadata_response @"$s14generic_vtable8ConcreteCMr"(ptr %0, ptr %1, ptr %2)
186184
// -- ClassLayoutFlags is 256 / 0x100, HasStaticVTable
187-
// CHECK: call swiftcc %swift.metadata_response @swift_initClassMetadata2(%swift.type* %0, [[INT]] 256, {{.*}})
185+
// CHECK: call swiftcc %swift.metadata_response @swift_initClassMetadata2(ptr %0, [[INT]] 256, {{.*}})
188186
// CHECK: ret %swift.metadata_response

test/IRGen/global_resilience.sil

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// RUN: %empty-directory(%t)
22

33
// RUN: %target-swift-frontend %S/../Inputs/resilient_struct.swift -enable-library-evolution -emit-module -emit-module-path %t/resilient_struct.swiftmodule
4-
// RUN: %target-swift-frontend %use_no_opaque_pointers -Xllvm -sil-disable-pass=simplification -enable-library-evolution -I %t -emit-ir %s | %FileCheck %s
5-
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=simplification -enable-library-evolution -I %t -emit-ir %s
4+
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=simplification -enable-library-evolution -I %t -emit-ir %s | %FileCheck %s
65
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=simplification -enable-library-evolution -I %t -emit-ir -O %s
76

87
// CHECK: %swift.type = type { [[INT:i32|i64]] }
@@ -64,7 +63,7 @@ bb0:
6463

6564
%addr = global_addr @smallGlobal : $*SmallResilientStruct
6665

67-
// CHECK: [[VALUE:%.*]] = load i32, i32* getelementptr inbounds (%T17global_resilience20SmallResilientStructV, %T17global_resilience20SmallResilientStructV* bitcast ([[BUFFER]]* @smallGlobal to %T17global_resilience20SmallResilientStructV*), i32 0, i32 0, i32 0)
66+
// CHECK: [[VALUE:%.*]] = load i32, ptr @smallGlobal
6867
%x_addr = struct_element_addr %addr : $*SmallResilientStruct, #SmallResilientStruct.x
6968
%x = load %x_addr : $*Int32
7069

@@ -75,11 +74,11 @@ bb0:
7574
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @testLargeGlobal()
7675
sil @testLargeGlobal : $@convention(thin) () -> () {
7776
bb0:
78-
// CHECK: [[ALLOC:%.*]] = call noalias i8* @swift_slowAlloc([[INT]] 32, [[INT]] 7)
79-
// CHECK: store i8* [[ALLOC]], i8** bitcast ([[BUFFER]]* @largeGlobal to i8**), align {{(8|4)}}
77+
// CHECK: [[ALLOC:%.*]] = call noalias ptr @swift_slowAlloc([[INT]] 32, [[INT]] 7)
78+
// CHECK: store ptr [[ALLOC]], ptr @largeGlobal, align {{(8|4)}}
8079
alloc_global @largeGlobal
8180

82-
// CHECK: [[VALUE:%.*]] = load %T17global_resilience20LargeResilientStructV*, %T17global_resilience20LargeResilientStructV** bitcast ([[BUFFER]]* @largeGlobal to %T17global_resilience20LargeResilientStructV**)
81+
// CHECK: [[VALUE:%.*]] = load ptr, ptr @largeGlobal
8382
%addr = global_addr @largeGlobal : $*LargeResilientStruct
8483

8584
%tuple = tuple ()
@@ -95,7 +94,7 @@ bb0:
9594

9695
%addr = global_addr @fixedGlobal : $*LargeResilientStruct
9796

98-
// CHECK: [[VALUE:%.*]] = load i64, i64* getelementptr inbounds (%T17global_resilience20LargeResilientStructV, %T17global_resilience20LargeResilientStructV* @fixedGlobal, i32 0, i32 1, i32 0)
97+
// CHECK: [[VALUE:%.*]] = load i64, ptr getelementptr inbounds (%T17global_resilience20LargeResilientStructV, ptr @fixedGlobal, i32 0, i32 1)
9998
%x_addr = struct_element_addr %addr : $*LargeResilientStruct, #LargeResilientStruct.x
10099
%x = load %x_addr : $*Int64
101100

@@ -108,10 +107,10 @@ sil @testOtherGlobal : $@convention(thin) () -> () {
108107
bb0:
109108
// CHECK: [[T0:%.*]] = call swiftcc %swift.metadata_response @"$s16resilient_struct4SizeVMa"([[INT]] 0)
110109
// CHECK: [[METADATA:%.*]] = extractvalue %swift.metadata_response [[T0]], 0
111-
// CHECK: call %swift.opaque* @__swift_allocate_value_buffer(%swift.type* [[METADATA]], %swift.opaque* bitcast ([{{.*}} x i8]* @otherGlobal to %swift.opaque*))
110+
// CHECK: call ptr @__swift_allocate_value_buffer(ptr [[METADATA]], ptr @otherGlobal)
112111
alloc_global @otherGlobal
113112

114-
// CHECK: call %swift.opaque* @__swift_project_value_buffer(%swift.type* [[METADATA]], %swift.opaque* bitcast ([{{.*}} x i8]* @otherGlobal to %swift.opaque*))
113+
// CHECK: call ptr @__swift_project_value_buffer(ptr [[METADATA]], ptr @otherGlobal)
115114
%addr = global_addr @otherGlobal : $*Size
116115

117116
%tuple = tuple ()
@@ -120,53 +119,44 @@ bb0:
120119
return %tuple : $()
121120
}
122121

123-
// CHECK-LABEL: define linkonce_odr hidden %swift.opaque* @__swift_allocate_value_buffer(%swift.type* %0, %swift.opaque* %1)
122+
// CHECK-LABEL: define linkonce_odr hidden ptr @__swift_allocate_value_buffer(ptr %0, ptr %1)
124123
// CHECK: entry:
125-
// CHECK: [[CAST:%.*]] = bitcast %swift.type* %0 to i8***
126-
// CHECK: [[VWT_ADDR:%.*]] = getelementptr inbounds i8**, i8*** [[CAST]], {{.*}} -1
127-
// CHECK: [[VWT:%.*]] = load i8**, i8*** [[VWT_ADDR]]
128-
// CHECK: [[VWT_CAST:%.*]] = bitcast i8** [[VWT]] to %swift.vwtable*
129-
// CHECK: [[FLAGS_ADDR:%.*]] = getelementptr inbounds %swift.vwtable, %swift.vwtable* [[VWT_CAST]], i32 0, i32 10
130-
// CHECK: [[FLAGS:%.*]] = load i32, i32* [[FLAGS_ADDR]]
124+
// CHECK: [[VWT_ADDR:%.*]] = getelementptr inbounds ptr, ptr %0, {{.*}} -1
125+
// CHECK: [[VWT:%.*]] = load ptr, ptr [[VWT_ADDR]]
126+
// CHECK: [[FLAGS_ADDR:%.*]] = getelementptr inbounds %swift.vwtable, ptr [[VWT]], i32 0, i32 10
127+
// CHECK: [[FLAGS:%.*]] = load i32, ptr [[FLAGS_ADDR]]
131128
// CHECK: [[ISNOTINLINE:%.*]] = and i32 [[FLAGS]], 131072
132129
// CHECK: [[ISINLINE:%.*]] = icmp eq i32 [[ISNOTINLINE]], 0
133130
// CHECK: br i1 [[ISINLINE]], label %done, label %outline.allocateValueInBuffer
134131
//
135132
// CHECK: outline.allocateValueInBuffer:
136-
// CHECK: [[CAST:%.*]] = bitcast %swift.type* %0 to i8***
137-
// CHECK: [[VWT_ADDR:%.*]] = getelementptr inbounds i8**, i8*** [[CAST]], {{.*}} -1
138-
// CHECK: [[VWT:%.*]] = load i8**, i8*** [[VWT_ADDR]]
139-
// CHECK: [[VWT_CAST:%.*]] = bitcast i8** [[VWT]] to %swift.vwtable*
140-
// CHECK: [[SIZE_ADDR:%.*]] = getelementptr inbounds %swift.vwtable, %swift.vwtable* [[VWT_CAST]], i32 0, i32 8
141-
// CHECK: [[SIZE:%.*]] = load [[INT]], [[INT]]* [[SIZE_ADDR]]
133+
// CHECK: [[VWT_ADDR:%.*]] = getelementptr inbounds ptr, ptr %0, {{.*}} -1
134+
// CHECK: [[VWT:%.*]] = load ptr, ptr [[VWT_ADDR]]
135+
// CHECK: [[SIZE_ADDR:%.*]] = getelementptr inbounds %swift.vwtable, ptr [[VWT]], i32 0, i32 8
136+
// CHECK: [[SIZE:%.*]] = load [[INT]], ptr [[SIZE_ADDR]]
142137
// CHECK: [[ALIGN:%.*]] = and {{.*}}, 255
143-
// CHECK: [[PTR:%.*]] = call noalias i8* @swift_slowAlloc({{.*}} [[SIZE]], {{.*}} [[ALIGN]])
144-
// CHECK: [[ADDR:%.*]] = bitcast %swift.opaque* %1 to i8**
145-
// CHECK: store i8* [[PTR]], i8** [[ADDR]]
146-
// CHECK: [[OUTLINEADDR:%.*]] = bitcast i8* [[PTR]] to %swift.opaque*
138+
// CHECK: [[PTR:%.*]] = call noalias ptr @swift_slowAlloc({{.*}} [[SIZE]], {{.*}} [[ALIGN]])
139+
// CHECK: store ptr [[PTR]], ptr %1
147140
// CHECK: br label %done
148141
//
149142
// CHECK: done:
150-
// CHECK: [[PHI:%.*]] = phi %swift.opaque* [ %1, %entry ], [ [[OUTLINEADDR]], %outline.allocateValueInBuffer ]
151-
// CHECK: ret %swift.opaque* [[PHI]]
143+
// CHECK: [[PHI:%.*]] = phi ptr [ %1, %entry ], [ [[PTR]], %outline.allocateValueInBuffer ]
144+
// CHECK: ret ptr [[PHI]]
152145

153146

154-
// CHECK-LABEL: define linkonce_odr hidden %swift.opaque* @__swift_project_value_buffer(%swift.type* %0, %swift.opaque* %1)
155-
// CHECK: [[CAST:%.*]] = bitcast %swift.type* %0 to i8***
156-
// CHECK: [[VWT_ADDR:%.*]] = getelementptr inbounds i8**, i8*** [[CAST]], {{.*}} -1
157-
// CHECK: [[VWT:%.*]] = load i8**, i8*** [[VWT_ADDR]]
158-
// CHECK: [[VWT_CAST:%.*]] = bitcast i8** [[VWT]] to %swift.vwtable*
159-
// CHECK: [[FLAGS_ADDR:%.*]] = getelementptr inbounds %swift.vwtable, %swift.vwtable* [[VWT_CAST]], i32 0, i32 10
160-
// CHECK: [[FLAGS:%.*]] = load i32, i32* [[FLAGS_ADDR]]
147+
// CHECK-LABEL: define linkonce_odr hidden ptr @__swift_project_value_buffer(ptr %0, ptr %1)
148+
// CHECK: [[VWT_ADDR:%.*]] = getelementptr inbounds ptr, ptr %0, {{.*}} -1
149+
// CHECK: [[VWT:%.*]] = load ptr, ptr [[VWT_ADDR]]
150+
// CHECK: [[FLAGS_ADDR:%.*]] = getelementptr inbounds %swift.vwtable, ptr [[VWT]], i32 0, i32 10
151+
// CHECK: [[FLAGS:%.*]] = load i32, ptr [[FLAGS_ADDR]]
161152
// CHECK: [[ISNOTINLINE:%.*]] = and i32 [[FLAGS]], 131072
162153
// CHECK: [[ISINLINE:%.*]] = icmp eq i32 [[ISNOTINLINE]], 0
163154
// CHECK: br i1 [[ISINLINE]], label %done, label %outline.projectValueInBuffer
164155
//
165156
// CHECK: outline.projectValueInBuffer:
166-
// CHECK: [[CAST:%.*]] = bitcast %swift.opaque* %1 to %swift.opaque**
167-
// CHECK: [[PTR_TO_BUFFER:%.*]] = load %swift.opaque*, %swift.opaque** [[CAST]]
157+
// CHECK: [[PTR_TO_BUFFER:%.*]] = load ptr, ptr %1
168158
// CHECK: br label %done
169159
//
170160
// CHECK: done:
171-
// CHECK: [[PHI:%.*]] = phi %swift.opaque* [ %1, %entry ], [ [[PTR_TO_BUFFER]], %outline.projectValueInBuffer ]
172-
// CHECK: ret %swift.opaque* [[PHI]]
161+
// CHECK: [[PHI:%.*]] = phi ptr [ %1, %entry ], [ [[PTR_TO_BUFFER]], %outline.projectValueInBuffer ]
162+
// CHECK: ret ptr [[PHI]]

0 commit comments

Comments
 (0)