Skip to content

Commit f6e7c16

Browse files
committed
[IRGen] Map types into context in typed throws code gen
Some types that should have been were not mapped into context.
1 parent 8beed30 commit f6e7c16

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4020,8 +4020,8 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) {
40204020
Builder.emitBlock(typedErrorLoadBB);
40214021

40224022
auto &errorTI = cast<LoadableTypeInfo>(IGM.getTypeInfo(errorType));
4023-
auto silResultTy =
4024-
substConv.getSILResultType(IGM.getMaximalTypeExpansionContext());
4023+
auto silResultTy = CurSILFn->mapTypeIntoContext(
4024+
substConv.getSILResultType(IGM.getMaximalTypeExpansionContext()));
40254025
auto &resultTI = cast<LoadableTypeInfo>(IGM.getTypeInfo(silResultTy));
40264026

40274027
auto &resultSchema = resultTI.nativeReturnValueSchema(IGM);
@@ -4498,8 +4498,8 @@ static void emitReturnInst(IRGenSILFunction &IGF,
44984498
SILType errorType;
44994499
if (fnType->hasErrorResult() && conv.isTypedError() &&
45004500
!conv.hasIndirectSILResults() && !conv.hasIndirectSILErrorResults()) {
4501-
errorType =
4502-
conv.getSILErrorType(IGF.IGM.getMaximalTypeExpansionContext());
4501+
errorType = IGF.CurSILFn->mapTypeIntoContext(
4502+
conv.getSILErrorType(IGF.IGM.getMaximalTypeExpansionContext()));
45034503
}
45044504
IGF.emitScalarReturn(resultTy, funcResultType, result, swiftCCReturn, false,
45054505
mayPeepholeLoad, errorType);
@@ -4566,12 +4566,12 @@ void IRGenSILFunction::visitThrowInst(swift::ThrowInst *i) {
45664566
llvm::Constant *flag = llvm::ConstantInt::get(IGM.IntPtrTy, 1);
45674567
flag = llvm::ConstantExpr::getIntToPtr(flag, IGM.Int8PtrTy);
45684568
Explosion errorResult = getLoweredExplosion(i->getOperand());
4569-
auto silErrorTy =
4570-
conv.getSILErrorType(IGM.getMaximalTypeExpansionContext());
4569+
auto silErrorTy = CurSILFn->mapTypeIntoContext(
4570+
conv.getSILErrorType(IGM.getMaximalTypeExpansionContext()));
45714571
auto &errorTI = cast<LoadableTypeInfo>(IGM.getTypeInfo(silErrorTy));
45724572

4573-
auto silResultTy =
4574-
conv.getSILResultType(IGM.getMaximalTypeExpansionContext());
4573+
auto silResultTy = CurSILFn->mapTypeIntoContext(
4574+
conv.getSILResultType(IGM.getMaximalTypeExpansionContext()));
45754575

45764576
if (silErrorTy.getASTType()->isNever()) {
45774577
emitTrap("Never can't be initialized", true);
@@ -4621,12 +4621,12 @@ void IRGenSILFunction::visitThrowInst(swift::ThrowInst *i) {
46214621
conv.getSILResultType(IGM.getMaximalTypeExpansionContext()));
46224622

46234623
if (conv.isTypedError()) {
4624-
auto silErrorTy =
4625-
conv.getSILErrorType(IGM.getMaximalTypeExpansionContext());
4624+
auto silErrorTy = CurSILFn->mapTypeIntoContext(
4625+
conv.getSILErrorType(IGM.getMaximalTypeExpansionContext()));
46264626
auto &errorTI = cast<LoadableTypeInfo>(IGM.getTypeInfo(silErrorTy));
46274627

4628-
auto silResultTy =
4629-
conv.getSILResultType(IGM.getMaximalTypeExpansionContext());
4628+
auto silResultTy = CurSILFn->mapTypeIntoContext(
4629+
conv.getSILResultType(IGM.getMaximalTypeExpansionContext()));
46304630
auto &resultTI = cast<LoadableTypeInfo>(IGM.getTypeInfo(silResultTy));
46314631
auto &resultSchema = resultTI.nativeReturnValueSchema(IGM);
46324632
auto &errorSchema = errorTI.nativeReturnValueSchema(IGM);

0 commit comments

Comments
 (0)