Skip to content

Commit b341624

Browse files
Merge pull request #39546 from kateinoigakukun/katei/fix-keypath-cc-mismatch
[IRGen] Emit keypath thunk helpers with swiftcc to match with the caller cc
2 parents 46fd9b3 + b5ae4d1 commit b341624

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lib/IRGen/GenKeyPath.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ getLayoutFunctionForComputedComponent(IRGenModule &IGM,
281281
auto layoutFn = llvm::Function::Create(fnTy,
282282
llvm::GlobalValue::PrivateLinkage, "keypath_get_arg_layout", IGM.getModule());
283283
layoutFn->setAttributes(IGM.constructInitialAttributes());
284+
layoutFn->setCallingConv(IGM.SwiftCC);
284285

285286
{
286287
IRGenFunction IGF(IGM, layoutFn);
@@ -383,6 +384,7 @@ getWitnessTableForComputedComponent(IRGenModule &IGM,
383384
llvm::GlobalValue::PrivateLinkage, "keypath_destroy", IGM.getModule());
384385
destroy = destroyFn;
385386
destroyFn->setAttributes(IGM.constructInitialAttributes());
387+
destroyFn->setCallingConv(IGM.SwiftCC);
386388

387389
IRGenFunction IGF(IGM, destroyFn);
388390
if (IGM.DebugInfo)
@@ -432,6 +434,7 @@ getWitnessTableForComputedComponent(IRGenModule &IGM,
432434
llvm::GlobalValue::PrivateLinkage, "keypath_copy", IGM.getModule());
433435
copy = copyFn;
434436
copyFn->setAttributes(IGM.constructInitialAttributes());
437+
copyFn->setCallingConv(IGM.SwiftCC);
435438

436439
IRGenFunction IGF(IGM, copyFn);
437440
if (IGM.DebugInfo)
@@ -545,6 +548,7 @@ getInitializerForComputedComponent(IRGenModule &IGM,
545548
auto initFn = llvm::Function::Create(fnTy,
546549
llvm::GlobalValue::PrivateLinkage, "keypath_arg_init", IGM.getModule());
547550
initFn->setAttributes(IGM.constructInitialAttributes());
551+
initFn->setCallingConv(IGM.SwiftCC);
548552

549553
{
550554
IRGenFunction IGF(IGM, initFn);

test/IRGen/default_function_ir_attributes.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,35 +119,35 @@ func test_computed_key_path_sil_thunks() -> KeyPath<S, Int> {
119119
}
120120

121121
// helper function: IR-generated key path getter
122-
// CHECK-LABEL: define {{.*}} @keypath_get(
122+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_get(
123123
// CHECK-SAME: [[ATTRS_SIMPLE]]
124124

125125
// helper function: IR-generated key path setter
126-
// CHECK-LABEL: define {{.*}} @keypath_set(
126+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_set(
127127
// CHECK-SAME: [[ATTRS_SIMPLE]]
128128

129129
// helper function: IR-generated key path arg layout accessor
130-
// CHECK-LABEL: define {{.*}} @keypath_get_arg_layout(
130+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_get_arg_layout(
131131
// CHECK-SAME: [[ATTRS_SIMPLE]]
132132

133133
// helper function: IR-generated key path destroy function
134-
// CHECK-LABEL: define {{.*}} @keypath_destroy(
134+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_destroy(
135135
// CHECK-SAME: [[ATTRS_SIMPLE]]
136136

137137
// helper function: IR-generated key path copy function
138-
// CHECK-LABEL: define {{.*}} @keypath_copy(
138+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_copy(
139139
// CHECK-SAME: [[ATTRS_SIMPLE]]
140140

141141
// helper function: IR-generated key path equals function
142-
// CHECK-LABEL: define {{.*}} @keypath_equals(
142+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_equals(
143143
// CHECK-SAME: [[ATTRS_SIMPLE]]
144144

145145
// helper function: IR-generated key path hash function
146-
// CHECK-LABEL: define {{.*}} @keypath_hash(
146+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_hash(
147147
// CHECK-SAME: [[ATTRS_SIMPLE]]
148148

149149
// helper function: IR-generated key path argument initializer
150-
// CHECK-LABEL: define {{.*}} @keypath_arg_init(
150+
// CHECK-LABEL: define {{.*}} swiftcc {{.*}} @keypath_arg_init(
151151
// CHECK-SAME: [[ATTRS_SIMPLE]]
152152

153153
func test_computed_key_path_generic_thunks<T: P0 & Hashable>(value: T) -> KeyPath<S, Int> {

0 commit comments

Comments
 (0)