Skip to content

Commit a3f70c3

Browse files
authored
Merge pull request #65561 from slavapestov/sil-function-type-pack-mangling-5.9
ASTMangler: Fix mangling of SILFunctionType with @pack conventions [5.9]
2 parents 71e71be + 49087d0 commit a3f70c3

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,9 +1097,9 @@ static char getParamConvention(ParameterConvention conv) {
10971097
case ParameterConvention::Direct_Owned: return 'x';
10981098
case ParameterConvention::Direct_Unowned: return 'y';
10991099
case ParameterConvention::Direct_Guaranteed: return 'g';
1100-
case ParameterConvention::Pack_Owned: return 'x';
1101-
case ParameterConvention::Pack_Inout: return 'y';
1102-
case ParameterConvention::Pack_Guaranteed: return 'g';
1100+
case ParameterConvention::Pack_Owned: return 'v';
1101+
case ParameterConvention::Pack_Inout: return 'm';
1102+
case ParameterConvention::Pack_Guaranteed: return 'p';
11031103
}
11041104
llvm_unreachable("bad parameter convention");
11051105
}

lib/Demangling/Demangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ NodePointer Demangler::demangleImplParamConvention(Node::Kind ConvKind) {
20682068
case 'y': attr = "@unowned"; break;
20692069
case 'v': attr = "@pack_owned"; break;
20702070
case 'p': attr = "@pack_guaranteed"; break;
2071-
case 'm': attr = "@pack_guaranteed"; break;
2071+
case 'm': attr = "@pack_inout"; break;
20722072
default:
20732073
pushBack();
20742074
return nullptr;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %target-swift-frontend -emit-ir %s -g | %FileCheck %s
2+
3+
// CHECK: !{{[0-9]+}} = !DICompositeType(tag: DW_TAG_structure_type, name: "$sxxQp_QSiIgp_D", {{.*}})
4+
public func f<each Input>(builder: (repeat each Input) -> ()) {}

test/SILGen/variadic-generic-reabstraction.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ func forwardAndReabstractFunctionPack<each T>(functions: repeat (each T) -> Bool
5353

5454
// CHECK-LABEL: sil{{.*}} @$s4main22passConcreteToVariadic2fnyS2i_SStXE_tF :
5555
// CHECK: [[COPY:%.*]] = copy_value %0 : $@noescape @callee_guaranteed (Int, @guaranteed String) -> Int
56-
// CHECK: [[THUNK:%.*]] = function_ref @$sSiSSSiIgygd_Si_SSQSiSiIeggd_TR
56+
// CHECK: [[THUNK:%.*]] = function_ref @$sSiSSSiIgygd_Si_SSQSiSiIegpd_TR
5757
// CHECK: partial_apply [callee_guaranteed] [[THUNK]]([[COPY]])
5858
func passConcreteToVariadic(fn: (Int, String) -> Int) {
5959
takesVariadicFunction(function: fn)
6060
}
6161

62-
// CHECK-LABEL: sil{{.*}} @$sSiSSSiIgygd_Si_SSQSiSiIeggd_TR :
62+
// CHECK-LABEL: sil{{.*}} @$sSiSSSiIgygd_Si_SSQSiSiIegpd_TR :
6363
// CHECK: bb0(%0 : $*Pack{Int, String}, %1 : @guaranteed $@noescape @callee_guaranteed (Int, @guaranteed String) -> Int):
6464
// CHECK-NEXT: [[INT_INDEX:%.*]] = scalar_pack_index 0 of $Pack{Int, String}
6565
// CHECK-NEXT: [[INT_ADDR:%.*]] = pack_element_get [[INT_INDEX]] of %0 : $*Pack{Int, String}
@@ -74,7 +74,7 @@ func passConcreteToVariadic(fn: (Int, String) -> Int) {
7474
// FIXME: we aren't preserving that the argument is owned
7575
// CHECK-LABEL: sil{{.*}} @$s4main27passConcreteToOwnedVariadic2fnyS2i_SStXE_tF :
7676
// CHECK: [[COPY:%.*]] = copy_value %0 : $@noescape @callee_guaranteed (Int, @guaranteed String) -> Int
77-
// CHECK: [[THUNK:%.*]] = function_ref @$sSiSSSiIgygd_Si_SSQSiSiIeggd_TR
77+
// CHECK: [[THUNK:%.*]] = function_ref @$sSiSSSiIgygd_Si_SSQSiSiIegpd_TR
7878
// CHECK: partial_apply [callee_guaranteed] [[THUNK]]([[COPY]])
7979
func passConcreteToOwnedVariadic(fn: (Int, String) -> Int) {
8080
takesVariadicOwnedFunction(function: fn)

0 commit comments

Comments
 (0)