Skip to content

Commit 00d681b

Browse files
Merge pull request #66780 from aschwaighofer/fix_some_opaque_ptr_tests_01
Fix some opaque pointer LLVM IR tests
2 parents 21f4cc1 + 8204f08 commit 00d681b

12 files changed

+192
-233
lines changed

test/AutoDiff/IRGen/differentiable_function.sil

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-frontend %use_no_opaque_pointers -emit-ir %s | %FileCheck %s
2-
// RUN: %target-swift-frontend -emit-ir %s
1+
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
32

43
sil_stage raw
54

@@ -34,7 +33,7 @@ bb0:
3433
return %result : $@differentiable(reverse) @callee_guaranteed (Float) -> Float
3534
}
3635

37-
// CHECK-LABEL: define{{.*}}test_form_diff_func(<{ %swift.function, %swift.function, %swift.function }>* noalias nocapture sret(<{ %swift.function, %swift.function, %swift.function }>)
36+
// CHECK-LABEL: define{{.*}}test_form_diff_func(ptr noalias nocapture sret(<{ %swift.function, %swift.function, %swift.function }>)
3837
// CHECK-SAME: [[OUT:%.*]])
3938
// CHECK: [[OUT_ORIG:%.*]] = getelementptr{{.*}}[[OUT]], i32 0, i32 0
4039
// CHECK: [[OUT_ORIG_FN:%.*]] = getelementptr{{.*}}[[OUT_ORIG]], i32 0, i32 0
@@ -61,8 +60,8 @@ bb0(%0 : $@differentiable(reverse) @callee_guaranteed (Float) -> Float):
6160
return %result : $(@callee_guaranteed (Float) -> Float, @callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float), @callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float))
6261
}
6362

64-
// CHECK-LABEL: define{{.*}}@test_extract_components(<{ %swift.function, %swift.function, %swift.function }>* noalias nocapture sret(<{ %swift.function, %swift.function, %swift.function }>)
65-
// CHECK-SAME: [[OUT:%.*]], <{ %swift.function, %swift.function, %swift.function }>*{{.*}}[[IN:%.*]])
63+
// CHECK-LABEL: define{{.*}}@test_extract_components(ptr noalias nocapture sret(<{ %swift.function, %swift.function, %swift.function }>)
64+
// CHECK-SAME: [[OUT:%.*]], ptr{{.*}}[[IN:%.*]])
6665
// CHECK: [[ORIG:%.*]] = getelementptr{{.*}}[[IN]], i32 0, i32 0
6766
// CHECK: [[ORIG_FN_ADDR:%.*]] = getelementptr{{.*}}[[ORIG]], i32 0, i32 0
6867
// CHECK: [[ORIG_FN:%.*]] = load{{.*}}[[ORIG_FN_ADDR]]
@@ -100,15 +99,14 @@ bb0(%0 : $@differentiable(reverse) @callee_guaranteed (Float) -> Float, %1 : $Fl
10099
return %2 : $Float
101100
}
102101

103-
// CHECK-LABEL: define{{.*}}@test_call_diff_fn(<{ %swift.function, %swift.function, %swift.function }>*
102+
// CHECK-LABEL: define{{.*}}@test_call_diff_fn(ptr
104103
// CHECK-SAME: [[DIFF_FN:%.*]], float [[INPUT_FLOAT:%.*]])
105104
// CHECK: [[ORIG:%.*]] = getelementptr{{.*}}[[DIFF_FN]], i32 0, i32 0
106105
// CHECK: [[ORIG_FN_ADDR:%.*]] = getelementptr{{.*}}[[ORIG]], i32 0, i32 0
107106
// CHECK: [[ORIG_FN:%.*]] = load{{.*}}[[ORIG_FN_ADDR]]
108107
// CHECK: [[ORIG_DATA_ADDR:%.*]] = getelementptr{{.*}}[[ORIG]], i32 0, i32 1
109108
// CHECK: [[ORIG_DATA:%.*]] = load{{.*}}[[ORIG_DATA_ADDR]]
110-
// CHECK: [[ORIG_FN_CAST:%.*]] = bitcast{{.*}}[[ORIG_FN]]
111-
// CHECK: [[RESULT:%.*]] = call swiftcc float [[ORIG_FN_CAST]](float [[INPUT_FLOAT]], %swift.refcounted* swiftself [[ORIG_DATA]])
109+
// CHECK: [[RESULT:%.*]] = call swiftcc float [[ORIG_FN]](float [[INPUT_FLOAT]], ptr swiftself [[ORIG_DATA]])
112110
// CHECK: ret float [[RESULT]]
113111

114112
sil @test_convert_escape_to_noescape : $@convention(thin) (@guaranteed @differentiable(reverse) @callee_guaranteed (Float) -> Float) -> () {

test/AutoDiff/IRGen/runtime.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-frontend %use_no_opaque_pointers -parse-stdlib %s -emit-ir | %FileCheck %s
2-
// RUN: %target-swift-frontend -parse-stdlib %s -emit-ir
1+
// RUN: %target-swift-frontend -parse-stdlib %s -emit-ir | %FileCheck %s
32

43
import Swift
54
import _Differentiation
@@ -20,6 +19,6 @@ func test_context_builtins() {
2019

2120
// CHECK-LABEL: define{{.*}}@test_context_builtins()
2221
// CHECK: entry:
23-
// CHECK: [[CTX:%.*]] = call swiftcc %swift.refcounted* @swift_autoDiffCreateLinearMapContext({{i[0-9]+}} {{.*}})
24-
// CHECK: call swiftcc i8* @swift_autoDiffProjectTopLevelSubcontext(%swift.refcounted* [[CTX]])
25-
// CHECK: [[BUF:%.*]] = call swiftcc i8* @swift_autoDiffAllocateSubcontext(%swift.refcounted* [[CTX]], {{i[0-9]+}} {{.*}})
22+
// CHECK: [[CTX:%.*]] = call swiftcc ptr @swift_autoDiffCreateLinearMapContext({{i[0-9]+}} {{.*}})
23+
// CHECK: call swiftcc ptr @swift_autoDiffProjectTopLevelSubcontext(ptr [[CTX]])
24+
// CHECK: [[BUF:%.*]] = call swiftcc ptr @swift_autoDiffAllocateSubcontext(ptr [[CTX]], {{i[0-9]+}} {{.*}})

test/AutoDiff/SIL/differentiability_witness_function_inst.sil

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
// IRGen test.
1717

18-
// RUN: %target-swift-frontend %use_no_opaque_pointers -Xllvm -sil-disable-pass=Simplification -emit-ir %s | %FileCheck %s --check-prefix=IRGEN --check-prefix %target-cpu
19-
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=Simplification -emit-ir %s
18+
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=Simplification -emit-ir %s | %FileCheck %s --check-prefix=IRGEN --check-prefix %target-cpu
2019
// NOTE: `%target-cpu`-specific FileCheck lines exist because lowered function types in LLVM IR differ between architectures.
2120

2221
// `shell` is required only to run `sed` as a
@@ -94,25 +93,16 @@ bb0:
9493

9594
// IRGEN-LABEL: define {{.*}} @test_derivative_witnesses()
9695

97-
// IRGEN: [[PTR1:%.*]] = load i8*, i8** getelementptr inbounds (%swift.differentiability_witness, %swift.differentiability_witness* @fooWJrSUUpSr, i32 0, i32 0), align [[PTR_ALIGNMENT]]
98-
// IRGEN: [[FNPTR1:%.*]] = bitcast i8* [[PTR1]] to { float, i8*, %swift.refcounted* } (float, float, float)*
96+
// IRGEN: [[PTR1:%.*]] = load ptr, ptr @fooWJrSUUpSr, align [[PTR_ALIGNMENT]]
9997

100-
// IRGEN: [[PTR2:%.*]] = load i8*, i8** getelementptr inbounds (%swift.differentiability_witness, %swift.differentiability_witness* @fooWJrSSUpSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]
101-
// IRGEN: [[FNPTR2:%.*]] = bitcast i8* [[PTR2]] to { float, i8*, %swift.refcounted* } (float, float, float)*
98+
// IRGEN: [[PTR2:%.*]] = load ptr, ptr getelementptr inbounds (%swift.differentiability_witness, ptr @fooWJrSSUpSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]
10299

103-
// IRGEN: [[PTR3:%.*]] = load i8*, i8** getelementptr inbounds (%swift.differentiability_witness, %swift.differentiability_witness* @barWJrSUUpSUr, i32 0, i32 0), align [[PTR_ALIGNMENT]]
104-
// x86_64: [[FNPTR3:%.*]] = bitcast i8* [[PTR3]] to { float, float, i8*, %swift.refcounted* } (float, float, float)*
105-
// i386: [[FNPTR3:%.*]] = bitcast i8* [[PTR3]] to void (<{ %TSf, %TSf, %swift.function }>*, float, float, float)*
100+
// IRGEN: [[PTR3:%.*]] = load ptr, ptr @barWJrSUUpSUr, align [[PTR_ALIGNMENT]]
106101

107-
// IRGEN: [[PTR4:%.*]] = load i8*, i8** getelementptr inbounds (%swift.differentiability_witness, %swift.differentiability_witness* @barWJrSSUpSSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]
108-
// x86_64: [[FNPTR4:%.*]] = bitcast i8* [[PTR4]] to { float, float, i8*, %swift.refcounted* } (float, float, float)*
109-
// i386: [[FNPTR4:%.*]] = bitcast i8* [[PTR4]] to void (<{ %TSf, %TSf, %swift.function }>*, float, float, float)*
102+
// IRGEN: [[PTR4:%.*]] = load ptr, ptr getelementptr inbounds (%swift.differentiability_witness, ptr @barWJrSSUpSSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]
110103

111-
// IRGEN: [[PTR5:%.*]] = load i8*, i8** getelementptr inbounds (%swift.differentiability_witness, %swift.differentiability_witness* @generic16_Differentiation14DifferentiableRzlWJrSUpSr, i32 0, i32 0), align [[PTR_ALIGNMENT]]
112-
// IRGEN: [[FNPTR5:%.*]] = bitcast i8* [[PTR5]] to { i8*, %swift.refcounted* } (%swift.opaque*, %swift.opaque*, float, %swift.type*, i8**)*
104+
// IRGEN: [[PTR5:%.*]] = load ptr, ptr @generic16_Differentiation14DifferentiableRzlWJrSUpSr, align [[PTR_ALIGNMENT]]
113105

114-
// IRGEN: [[PTR6:%.*]] = load i8*, i8** getelementptr inbounds (%swift.differentiability_witness, %swift.differentiability_witness* @generics18AdditiveArithmeticRz16_Differentiation14DifferentiableRzlWJrSSpSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]
115-
// IRGEN: [[FNPTR6:%.*]] = bitcast i8* [[PTR6]] to { i8*, %swift.refcounted* } (%swift.opaque*, %swift.opaque*, float, %swift.type*, i8**, i8**)*
106+
// IRGEN: [[PTR6:%.*]] = load ptr, ptr getelementptr inbounds (%swift.differentiability_witness, ptr @generics18AdditiveArithmeticRz16_Differentiation14DifferentiableRzlWJrSSpSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]
116107

117-
// IRGEN: [[PTR7:%.*]] = load i8*, i8** getelementptr inbounds (%swift.differentiability_witness, %swift.differentiability_witness* @generic16_Differentiation14DifferentiableRz13TangentVector{{.*}}WJrSSpSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]
118-
// IRGEN: [[FNPTR7:%.*]] = bitcast i8* [[PTR7]] to { i8*, %swift.refcounted* } (%swift.opaque*, %swift.opaque*, float, %swift.type*, i8**)*
108+
// IRGEN: [[PTR7:%.*]] = load ptr, ptr getelementptr inbounds (%swift.differentiability_witness, ptr @generic16_Differentiation14DifferentiableRz13TangentVector{{.*}}WJrSSpSr, i32 0, i32 1), align [[PTR_ALIGNMENT]]

test/AutoDiff/SIL/differentiable_function_inst.sil

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
// IRGen test.
1717

18-
// RUN: %target-swift-frontend %use_no_opaque_pointers -emit-ir %s | %FileCheck %s --check-prefix=CHECK-IRGEN
19-
// RUN: %target-swift-frontend -emit-ir %s
18+
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK-IRGEN
2019

2120
// `shell` is required only to run `sed` as a
2221
// https://github.com/apple/swift/issues/54526 workaround.
@@ -66,9 +65,9 @@ bb0:
6665
// CHECK-SIL: [[EXTRACTED_ORIG_FN:%.*]] = differentiable_function_extract [original] [[DIFF_FN]] : $@differentiable(reverse) @convention(thin) (Float) -> Float
6766
// CHECK-SIL: return [[DIFF_FN]] : $@differentiable(reverse) @convention(thin) (Float) -> Float
6867

69-
// CHECK-IRGEN-LABEL: define {{.*}}swiftcc { i8*, i8*, i8* } @make_differentiable_function()
68+
// CHECK-IRGEN-LABEL: define {{.*}}swiftcc { ptr, ptr, ptr } @make_differentiable_function()
7069
// CHECK-IRGEN-NEXT: entry:
71-
// CHECK-IRGEN-NEXT: ret { i8*, i8*, i8* } { i8* bitcast (float (float)* @function to i8*), i8* undef, i8* bitcast ({ float, i8*, %swift.refcounted* } (float)* @function_vjp to i8*) }
70+
// CHECK-IRGEN-NEXT: ret { ptr, ptr, ptr } { ptr @function, ptr undef, ptr @function_vjp }
7271

7372
sil @examplefunc : $@convention(thin) (Float, Float, Float) -> Float
7473
sil @examplemethod : $@convention(method) (Float, Float, Float) -> Float

test/AutoDiff/SIL/sil_differentiability_witness.sil

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
// IRGen test.
1717

18-
// RUN: %target-swift-frontend %use_no_opaque_pointers -emit-ir %s | %FileCheck --check-prefix=IRGEN %s
19-
// RUN: %target-swift-frontend -emit-ir %s
18+
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck --check-prefix=IRGEN %s
2019

2120
// `shell` is required only to run `sed` as a
2221
// https://github.com/apple/swift/issues/54526 workaround.
@@ -55,7 +54,7 @@ sil_differentiability_witness [reverse] [parameters 0] [results 0] @externalFn1
5554
// ROUNDTRIP: vjp: @AD__externalFn1__vjp_src_0_wrt_0 : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)
5655
// ROUNDTRIP: }
5756

58-
// IRGEN-LABEL: @externalFn1WJrSpSr ={{( protected)?}} global { i8*, i8* } {
57+
// IRGEN-LABEL: @externalFn1WJrSpSr ={{( protected)?}} global { ptr, ptr } {
5958
// IRGEN-SAME: @AD__externalFn1__jvp_src_0_wrt_0
6059
// IRGEN-SAME: @AD__externalFn1__vjp_src_0_wrt_0
6160
// IRGEN-SAME: }
@@ -79,7 +78,7 @@ sil_differentiability_witness [reverse] [parameters 0] [results 0] @externalFn2
7978
// ROUNDTRIP: vjp: @AD__externalFn2__vjp_src_0_wrt_0 : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)
8079
// ROUNDTRIP: }
8180

82-
// IRGEN-LABEL: @externalFn2WJrSpSr ={{( protected)?}} global { i8*, i8* } {
81+
// IRGEN-LABEL: @externalFn2WJrSpSr ={{( protected)?}} global { ptr, ptr } {
8382
// IRGEN-SAME: @AD__externalFn2__jvp_src_0_wrt_0
8483
// IRGEN-SAME: @AD__externalFn2__vjp_src_0_wrt_0
8584
// IRGEN-SAME: }
@@ -93,7 +92,7 @@ sil_differentiability_witness [reverse] [parameters 0] [results 0] @externalFn3
9392
// ROUNDTRIP-LABEL: // differentiability witness for externalFn3
9493
// ROUNDTRIP: sil_differentiability_witness{{( public_external)?}} [reverse] [parameters 0] [results 0] @externalFn3 : $@convention(thin) (Float) -> Float{{[^{]*$}}
9594

96-
// IRGEN-NOT: @AD__externalFn3{{.*}}={{.*}}{ i8*, i8* }
95+
// IRGEN-NOT: @AD__externalFn3{{.*}}={{.*}}{ ptr, ptr }
9796

9897
// Test public non-generic function.
9998
// SIL differentiability witness:
@@ -126,7 +125,7 @@ sil_differentiability_witness [reverse] [parameters 0] [results 0] @foo : $@conv
126125
// ROUNDTRIP: vjp: @AD__foo__vjp_src_0_wrt_0 : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)
127126
// ROUNDTRIP: }
128127

129-
// IRGEN-LABEL: @fooWJrSpSr ={{( protected)?}} global { i8*, i8* } {
128+
// IRGEN-LABEL: @fooWJrSpSr ={{( protected)?}} global { ptr, ptr } {
130129
// IRGEN-SAME: @AD__foo__jvp_src_0_wrt_0
131130
// IRGEN-SAME: @AD__foo__vjp_src_0_wrt_0
132131
// IRGEN-SAME: }
@@ -164,7 +163,7 @@ sil_differentiability_witness hidden [reverse] [parameters 0 1] [results 0] <τ_
164163
// ROUNDTRIP: vjp: @AD__generic__vjp_src_0_wrt_0_1 : $@convention(thin) <τ_0_0 where τ_0_0 : Differentiable> (@in_guaranteed τ_0_0, Float) -> (@out τ_0_0, @owned @callee_guaranteed (@in_guaranteed τ_0_0.TangentVector) -> (@out τ_0_0.TangentVector, Float))
165164
// ROUNDTRIP: }
166165

167-
// IRGEN: @generic16_Differentiation14DifferentiableRzlWJrSSpSr = hidden global { i8*, i8* } {
166+
// IRGEN: @generic16_Differentiation14DifferentiableRzlWJrSSpSr = hidden global { ptr, ptr } {
168167
// IRGEN-SAME: @AD__generic__jvp_src_0_wrt_0_1
169168
// IRGEN-SAME: @AD__generic__vjp_src_0_wrt_0_1
170169
// IRGEN-SAME: }

test/AutoDiff/compiler_crashers_fixed/issue-58123-invalid-debug-info.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
// RUN: %target-swift-frontend %use_no_opaque_pointers -emit-ir -O -g %s | %FileCheck %s
2-
// RUN: %target-swift-frontend -emit-ir -O -g %s
1+
// RUN: %target-swift-frontend -emit-ir -O -g %s | %FileCheck %s
32

43
// https://github.com/apple/swift/issues/58123
54
// Mutating functions with control flow can cause assertion failure for
65
// conflicting debug variable type
76

87
// CHECK-LABEL: define internal swiftcc float @"$s4main8TestTypeV24doDifferentiableTimeStep04timeG0ySf_tFTJpSSpSrTA"
98
// CHECK: [[SELF:%.*]] = alloca %T4main8TestTypeV06ManualB7TangentV
10-
// CHECK: call void @llvm.dbg.declare(metadata %T4main8TestTypeV06ManualB7TangentV* [[SELF]]
9+
// CHECK: call void @llvm.dbg.declare(metadata ptr [[SELF]]
1110

1211
import _Differentiation
1312

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
// RUN: %target-swift-frontend %use_no_opaque_pointers -emit-ir -primary-file %s %S/Inputs/forward-declarations-other.swift -import-objc-header %S/Inputs/forward-declarations.h -enable-objc-interop -disable-objc-attr-requires-foundation-module -module-name main | %FileCheck %s
2-
// RUN: %target-swift-frontend -emit-ir -primary-file %s %S/Inputs/forward-declarations-other.swift -import-objc-header %S/Inputs/forward-declarations.h -enable-objc-interop -disable-objc-attr-requires-foundation-module -module-name main
1+
// RUN: %target-swift-frontend -emit-ir -primary-file %s %S/Inputs/forward-declarations-other.swift -import-objc-header %S/Inputs/forward-declarations.h -enable-objc-interop -disable-objc-attr-requires-foundation-module -module-name main | %FileCheck %s
32

43
class Sub: Base {
54
// CHECK-LABEL: define{{.*}} void @"$s4main3SubC4testyyF"
65
func test() {
7-
// CHECK: [[BASE_SELF:%.+]] = bitcast %T4main3SubC* %0 to %TSo4BaseC*
8-
// CHECK: [[SELECTOR:%.+]] = load i8*, i8** @"\01L_selector(getClassInstanceWithoutMentioningItsName)"
9-
// CHECK: [[OPAQUE_SELF:%.+]] = bitcast %TSo4BaseC* %2 to {{%.+}}*
10-
// CHECK: [[RESULT:%.+]] = call {{%.+}}* bitcast (void ()* @objc_msgSend to {{%.+}}* ({{%.+}}*, i8*)*)({{%.+}}* [[OPAQUE_SELF]], i8* [[SELECTOR]])
11-
// CHECK: [[OPAQUE_RESULT:%.+]] = bitcast {{%.+}}* [[RESULT]] to i8*
12-
// CHECK: call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* [[OPAQUE_RESULT]])
6+
// CHECK: [[SELECTOR:%.+]] = load ptr, ptr @"\01L_selector(getClassInstanceWithoutMentioningItsName)"
7+
// CHECK: [[RESULT:%.+]] = call ptr @objc_msgSend(ptr %{{[0-9]+}}, ptr [[SELECTOR]])
8+
// CHECK: call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr [[RESULT]])
139
_ = self.getClassInstanceWithoutMentioningItsName()
14-
// CHECK: call void @swift_release(%swift.refcounted* {{%.+}})
10+
// CHECK: call void @swift_release(ptr {{%.+}})
1511
// CHECK: ret void
1612
}
1713
}

test/ClangImporter/cxx_interop_ir.swift

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swiftxx-frontend %use_no_opaque_pointers -module-name cxx_ir -I %S/Inputs/custom-modules -emit-ir -o - -primary-file %s -Xcc -fignore-exceptions | %FileCheck %s
2-
// RUN: %target-swiftxx-frontend -module-name cxx_ir -I %S/Inputs/custom-modules -emit-ir -o - -primary-file %s -Xcc -fignore-exceptions
1+
// RUN: %target-swiftxx-frontend -module-name cxx_ir -I %S/Inputs/custom-modules -emit-ir -o - -primary-file %s -Xcc -fignore-exceptions | %FileCheck %s
32

43
// https://github.com/apple/swift/issues/55575
54
// We can't yet call member functions correctly on Windows.
@@ -8,13 +7,13 @@
87
import CXXInterop
98

109
// CHECK-LABEL: define hidden swiftcc void @"$s6cxx_ir13indirectUsageyyF"()
11-
// CHECK: %0 = call %"class.ns::T"* @{{_Z5makeTv|"\?makeT@@YAPE?AVT@ns@@XZ"}}()
12-
// CHECK: call void @{{_Z4useTPN2ns1TE|"\?useT@@YAXPE?AVT@ns@@@Z"}}(%"class.ns::T"* %2)
10+
// CHECK: %0 = call ptr @{{_Z5makeTv|"\?makeT@@YAPE?AVT@ns@@XZ"}}()
11+
// CHECK: call void @{{_Z4useTPN2ns1TE|"\?useT@@YAXPE?AVT@ns@@@Z"}}(ptr %2)
1312
func indirectUsage() {
1413
useT(makeT())
1514
}
1615

17-
// CHECK-LABEL: define hidden swiftcc %swift.type* @"$s6cxx_ir14reflectionInfo3argypXpSo2nsO1TV_tF"
16+
// CHECK-LABEL: define hidden swiftcc ptr @"$s6cxx_ir14reflectionInfo3argypXpSo2nsO1TV_tF"
1817
// CHECK: %0 = call swiftcc %swift.metadata_response @"$sSo2nsO1TVMa"({{i64|i32}} 0)
1918
func reflectionInfo(arg: namespacedT) -> Any.Type {
2019
return type(of: arg)
@@ -29,26 +28,22 @@ func namespaceManglesIntoNameForUsingShadowDecl(arg: NamespacedType) {
2928
}
3029

3130
// CHECK-LABEL: define hidden swiftcc void @"$s6cxx_ir14accessNSMemberyyF"()
32-
// CHECK: %0 = call %"class.ns::T"* @{{_ZN2ns7doMakeTEv|"\?doMakeT@ns@@YAPEAVT@1@XZ"}}()
33-
// CHECK: call void @{{_Z4useTPN2ns1TE|"\?useT@@YAXPE?AVT@ns@@@Z"}}(%"class.ns::T"* %2)
31+
// CHECK: %0 = call ptr @{{_ZN2ns7doMakeTEv|"\?doMakeT@ns@@YAPEAVT@1@XZ"}}()
32+
// CHECK: call void @{{_Z4useTPN2ns1TE|"\?useT@@YAXPE?AVT@ns@@@Z"}}(ptr %2)
3433
func accessNSMember() {
3534
useT(ns.doMakeT())
3635
}
3736

38-
// CHECK-LABEL: define hidden swiftcc i32 @"$s6cxx_ir12basicMethods1as5Int32VSpySo0D0VG_tF"(i8* %0)
39-
// CHECK: [[THIS_PTR1:%.*]] = bitcast i8* %0 to %TSo7MethodsV*
40-
// CHECK: [[THIS_PTR2:%.*]] = bitcast %TSo7MethodsV* [[THIS_PTR1]] to %class.Methods*
41-
// CHECK: [[RESULT:%.*]] = call {{(signext )?}}i32 @{{_ZN7Methods12SimpleMethodEi|"\?SimpleMethod@Methods@@QEAAHH@Z"}}(%class.Methods* [[THIS_PTR2]], i32 {{%?[0-9]+}})
37+
// CHECK-LABEL: define hidden swiftcc i32 @"$s6cxx_ir12basicMethods1as5Int32VSpySo0D0VG_tF"(ptr %0)
38+
// CHECK: [[RESULT:%.*]] = call {{(signext )?}}i32 @{{_ZN7Methods12SimpleMethodEi|"\?SimpleMethod@Methods@@QEAAHH@Z"}}(ptr %0, i32 {{%?[0-9]+}})
4239
// CHECK: ret i32 [[RESULT]]
4340
func basicMethods(a: UnsafeMutablePointer<Methods>) -> Int32 {
4441
return a.pointee.SimpleMethod(4)
4542
}
4643

47-
// CHECK-LABEL: define hidden swiftcc i32 @"$s6cxx_ir17basicMethodsConst1as5Int32VSpySo0D0VG_tF"(i8* %0)
44+
// CHECK-LABEL: define hidden swiftcc i32 @"$s6cxx_ir17basicMethodsConst1as5Int32VSpySo0D0VG_tF"(ptr %0)
4845
// CHECK: [[THIS_PTR1:%.*]] = alloca %TSo7MethodsV, align {{4|8}}
49-
// CHECK: [[THIS_PTR2:%.*]] = bitcast %TSo7MethodsV* [[THIS_PTR1]] to %class.Methods*
50-
// CHECK: [[THIS_PTR3:%.*]] = bitcast %TSo7MethodsV* [[THIS_PTR1]] to %class.Methods*
51-
// CHECK: [[RESULT:%.*]] = call {{(signext )?}}i32 @{{_ZNK7Methods17SimpleConstMethodEi|"\?SimpleConstMethod@Methods@@QEBAHH@Z"}}(%class.Methods* [[THIS_PTR3]], i32 {{%?[0-9]+}})
46+
// CHECK: [[RESULT:%.*]] = call {{(signext )?}}i32 @{{_ZNK7Methods17SimpleConstMethodEi|"\?SimpleConstMethod@Methods@@QEBAHH@Z"}}(ptr [[THIS_PTR1]], i32 {{%?[0-9]+}})
5247
// CHECK: ret i32 [[RESULT]]
5348
func basicMethodsConst(a: UnsafeMutablePointer<Methods>) -> Int32 {
5449
return a.pointee.SimpleConstMethod(3)
@@ -61,10 +56,8 @@ func basicMethodsStatic() -> Int32 {
6156
return Methods.SimpleStaticMethod(5)
6257
}
6358

64-
// CHECK-LABEL: define hidden swiftcc i32 @"$s6cxx_ir12basicMethods1as5Int32VSpySo8Methods2VG_tF"(i8* %0)
65-
// CHECK: [[THIS_PTR1:%.*]] = bitcast i8* %0 to %TSo8Methods2V*
66-
// CHECK: [[THIS_PTR2:%.*]] = bitcast %TSo8Methods2V* [[THIS_PTR1]] to %class.Methods2*
67-
// CHECK: [[RESULT:%.*]] = call {{(signext )?}}i32 @{{_ZN8Methods212SimpleMethodEi|"\?SimpleMethod@Methods2@@QEAAHH@Z"}}(%class.Methods2* [[THIS_PTR2]], i32 {{%?[0-9]+}})
59+
// CHECK-LABEL: define hidden swiftcc i32 @"$s6cxx_ir12basicMethods1as5Int32VSpySo8Methods2VG_tF"(ptr %0)
60+
// CHECK: [[RESULT:%.*]] = call {{(signext )?}}i32 @{{_ZN8Methods212SimpleMethodEi|"\?SimpleMethod@Methods2@@QEAAHH@Z"}}(ptr %0, i32 {{%?[0-9]+}})
6861
// CHECK: ret i32 [[RESULT]]
6962
func basicMethods(a: UnsafeMutablePointer<Methods2>) -> Int32 {
7063
return a.pointee.SimpleMethod(4)

0 commit comments

Comments
 (0)