Skip to content

Commit 9c30f4d

Browse files
committed
IRGen: partial_apply cannot produce noescape functions
1 parent 4671f89 commit 9c30f4d

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lib/IRGen/GenFunc.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ void irgen::emitFunctionPartialApplication(
13461346
SmallVector<SILType, 4> argValTypes;
13471347
SmallVector<ParameterConvention, 4> argConventions;
13481348

1349-
bool isNoEscapeFunction = outType->isNoEscape();
1349+
assert(!outType->isNoEscape());
13501350

13511351
// Reserve space for polymorphic bindings.
13521352
SubstitutionMap subMap;
@@ -1476,10 +1476,7 @@ void irgen::emitFunctionPartialApplication(
14761476
fnPtr = IGF.Builder.CreateBitCast(fnPtr, IGF.IGM.Int8PtrTy);
14771477
out.add(fnPtr);
14781478
llvm::Value *ctx = args.claimNext();
1479-
if (isNoEscapeFunction)
1480-
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.OpaquePtrTy);
1481-
else
1482-
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.RefCountedPtrTy);
1479+
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.RefCountedPtrTy);
14831480
out.add(ctx);
14841481
return;
14851482
}
@@ -1520,10 +1517,7 @@ void irgen::emitFunctionPartialApplication(
15201517
llvm::Value *ctx = args.claimNext();
15211518
if (isIndirectFormalParameter(*singleRefcountedConvention))
15221519
ctx = IGF.Builder.CreateLoad(ctx, IGF.IGM.getPointerAlignment());
1523-
if (isNoEscapeFunction)
1524-
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.OpaquePtrTy);
1525-
else
1526-
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.RefCountedPtrTy);
1520+
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.RefCountedPtrTy);
15271521
out.add(ctx);
15281522
return;
15291523
}
@@ -1614,8 +1608,6 @@ void irgen::emitFunctionPartialApplication(
16141608
argConventions);
16151609
forwarder = IGF.Builder.CreateBitCast(forwarder, IGF.IGM.Int8PtrTy);
16161610
out.add(forwarder);
1617-
if (isNoEscapeFunction)
1618-
data = IGF.Builder.CreateBitCast(data, IGF.IGM.OpaquePtrTy);
16191611
out.add(data);
16201612
}
16211613

0 commit comments

Comments
 (0)