Skip to content

🌲: Merge branch 'main' into rebranch. #68133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c25b3b4
[Runtime] Restructure BytecodeLayouts
drexin Aug 21, 2023
ec3a2dc
[Runtime] Templatize shared functionality in BytecodeLayouts
drexin Aug 21, 2023
2f61e2a
[Runtime] Further abstract shared functionality in BytecodeLayouts
drexin Aug 21, 2023
4a395cb
[Runtime+IRGen] Some fixes and optimizations for layout strings
drexin Aug 21, 2023
31de67c
[IRGen+Runtime] Further fixes for layout strings
drexin Aug 21, 2023
27b1764
[Runtime+IRGen] Fix layout string flag in type layout and add array f…
drexin Aug 21, 2023
30d6282
[IRGen+Runtime] Make more fine grained copies in layout string runtim…
drexin Aug 21, 2023
4f6e69b
[Runtime] Reduce instruction count in simple layout string operations
drexin Aug 21, 2023
8ab845f
[Runtime+IRGen] Fix offsets of existentials in layout strings
drexin Aug 21, 2023
7c0203d
[Runtime] Combine copy and destroy in assignWithCopy
drexin Aug 21, 2023
8b3aaf5
[Runtime] Compute end before looping over single payload ref count
drexin Aug 21, 2023
56048ac
[Runtime+IRGen] Fix existential offset for multiple protocol witnesses
drexin Aug 21, 2023
7e3f56d
[Runtime] Fix generic existentials in layout strings
drexin Aug 21, 2023
734e9b8
[IRGen] Make enum metadata non-const for instantiated layout strings
drexin Aug 21, 2023
fd967fd
[Runtime] Properly handle boxed references in layout string instantia…
drexin Aug 21, 2023
0ff7f1d
[IRGen] Don't generate layout strings for moveonly types
drexin Aug 21, 2023
21f4064
[Runtime] Fix singlePayloadEnumSimpleAssignWithCopy
drexin Aug 21, 2023
a0e48a3
[Runtime] Assert when trying to get layout string from class
drexin Aug 21, 2023
904418f
[Test] Remove accidentally commited broken test code
drexin Aug 21, 2023
4a8d23d
[stdlib] Add @discardableResult to Set.insert’s AnyHashable overload
lorentey Aug 22, 2023
b7bde13
Merge branch 'wip-layout-strings-work'
drexin Aug 22, 2023
3e95214
[CodeCompletion] Add test case for some/any type relations
ahoppen Aug 23, 2023
7d13da4
Remove realpath in lit site config.
tristanlabelle Aug 23, 2023
e3a1bac
[Runtime] Use copy of addrOffset in single payload assign with copy
drexin Aug 24, 2023
97b2dc7
[IRGen] Assign extraTagByteCount to the correct union field in addSin…
drexin Aug 24, 2023
4e22193
[Test] Require asserts for some experimental-feature tests.
nate-chandler Aug 24, 2023
d5a3e2e
[AutoDiff] Fixes memory leaks in autodiff linear map context allocati…
jkshtj Aug 24, 2023
c765842
Merge pull request #68067 from lorentey/fix-Set.insert-overload-decl
lorentey Aug 24, 2023
2d171bd
Merge pull request #68103 from ahoppen/ahoppen/some-any-type-relation
ahoppen Aug 24, 2023
f7dcf1d
Merge pull request #68096 from tristanlabelle/remove-lit-realpath
compnerd Aug 24, 2023
030daee
Merge pull request #68042 from drexin/wip-layout-strings-work
drexin Aug 24, 2023
c17f686
Merge pull request #68129 from nate-chandler/test/20230824/1
swift-ci Aug 24, 2023
6ccd08b
Merge branch 'main' into rebranch.
nate-chandler Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions include/swift/ABI/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,8 @@ struct TargetMetadata {

const uint8_t *getLayoutString() const {
assert(hasLayoutString());
if (isAnyClass()) {
return asFullMetadata(
reinterpret_cast<const TargetAnyClassMetadata<Runtime> *>(
this))
->layoutString;
}
// Classes should not have layout strings
assert(!isAnyClass());
return asFullMetadata(this)->layoutString;
}

Expand Down
8 changes: 4 additions & 4 deletions include/swift/AST/Builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -985,14 +985,14 @@ BUILTIN_MISC_OPERATION_WITH_SILGEN(CreateAsyncTaskInGroup,
/// is a pure value and therefore we can consider it as readnone).
BUILTIN_MISC_OPERATION_WITH_SILGEN(GlobalStringTablePointer, "globalStringTablePointer", "n", Special)

// autoDiffCreateLinearMapContext: (Builtin.Word) -> Builtin.NativeObject
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffCreateLinearMapContext, "autoDiffCreateLinearMapContext", "", Special)
// autoDiffCreateLinearMapContextWithType: (T.Type) -> Builtin.NativeObject
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffCreateLinearMapContextWithType, "autoDiffCreateLinearMapContextWithType", "", Special)

// autoDiffProjectTopLevelSubcontext: (Builtin.NativeObject) -> Builtin.RawPointer
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffProjectTopLevelSubcontext, "autoDiffProjectTopLevelSubcontext", "n", Special)

// autoDiffAllocateSubcontext: (Builtin.NativeObject, Builtin.Word) -> Builtin.RawPointer
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffAllocateSubcontext, "autoDiffAllocateSubcontext", "", Special)
// autoDiffAllocateSubcontextWithType: (Builtin.NativeObject, T.Type) -> Builtin.RawPointer
BUILTIN_MISC_OPERATION_WITH_SILGEN(AutoDiffAllocateSubcontextWithType, "autoDiffAllocateSubcontextWithType", "", Special)

/// Build a Builtin.Executor value from an "ordinary" serial executor
/// reference.
Expand Down
16 changes: 8 additions & 8 deletions include/swift/Runtime/RuntimeFunctions.def
Original file line number Diff line number Diff line change
Expand Up @@ -2532,12 +2532,12 @@ FUNCTION(TaskGroupDestroy,
EFFECT(Concurrency),
UNKNOWN_MEMEFFECTS)

// AutoDiffLinearMapContext *swift_autoDiffCreateLinearMapContext(size_t);
FUNCTION(AutoDiffCreateLinearMapContext,
swift_autoDiffCreateLinearMapContext, SwiftCC,
// AutoDiffLinearMapContext *swift_autoDiffCreateLinearMapContextWithType(const Metadata *);
FUNCTION(AutoDiffCreateLinearMapContextWithType,
swift_autoDiffCreateLinearMapContextWithType, SwiftCC,
DifferentiationAvailability,
RETURNS(RefCountedPtrTy),
ARGS(SizeTy),
ARGS(TypeMetadataPtrTy),
ATTRS(NoUnwind),
EFFECT(AutoDiff),
MEMEFFECTS(ArgMemOnly))
Expand All @@ -2552,12 +2552,12 @@ FUNCTION(AutoDiffProjectTopLevelSubcontext,
EFFECT(AutoDiff),
MEMEFFECTS(ArgMemOnly))

// void *swift_autoDiffAllocateSubcontext(AutoDiffLinearMapContext *, size_t);
FUNCTION(AutoDiffAllocateSubcontext,
swift_autoDiffAllocateSubcontext, SwiftCC,
// void *swift_autoDiffAllocateSubcontextWithType(AutoDiffLinearMapContext *, const Metadata *);
FUNCTION(AutoDiffAllocateSubcontextWithType,
swift_autoDiffAllocateSubcontextWithType, SwiftCC,
DifferentiationAvailability,
RETURNS(Int8PtrTy),
ARGS(RefCountedPtrTy, SizeTy),
ARGS(RefCountedPtrTy, TypeMetadataPtrTy),
ATTRS(NoUnwind),
EFFECT(AutoDiff),
MEMEFFECTS(ArgMemOnly))
Expand Down
11 changes: 6 additions & 5 deletions lib/AST/Builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,8 @@ static ValueDecl *getBuildComplexEqualitySerialExecutorRef(ASTContext &ctx,
static ValueDecl *getAutoDiffCreateLinearMapContext(ASTContext &ctx,
Identifier id) {
return getBuiltinFunction(
id, {BuiltinIntegerType::getWordType(ctx)}, ctx.TheNativeObjectType);
ctx, id, _thin, _generics(_unrestricted),
_parameters(_metatype(_typeparam(0))), _nativeObject);
}

static ValueDecl *getAutoDiffProjectTopLevelSubcontext(ASTContext &ctx,
Expand All @@ -1621,8 +1622,8 @@ static ValueDecl *getAutoDiffProjectTopLevelSubcontext(ASTContext &ctx,
static ValueDecl *getAutoDiffAllocateSubcontext(ASTContext &ctx,
Identifier id) {
return getBuiltinFunction(
id, {ctx.TheNativeObjectType, BuiltinIntegerType::getWordType(ctx)},
ctx.TheRawPointerType);
ctx, id, _thin, _generics(_unrestricted),
_parameters(_nativeObject, _metatype(_typeparam(0))), _rawPointer);
}

static ValueDecl *getPoundAssert(ASTContext &Context, Identifier Id) {
Expand Down Expand Up @@ -2949,13 +2950,13 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
case BuiltinValueKind::HopToActor:
return getHopToActor(Context, Id);

case BuiltinValueKind::AutoDiffCreateLinearMapContext:
case BuiltinValueKind::AutoDiffCreateLinearMapContextWithType:
return getAutoDiffCreateLinearMapContext(Context, Id);

case BuiltinValueKind::AutoDiffProjectTopLevelSubcontext:
return getAutoDiffProjectTopLevelSubcontext(Context, Id);

case BuiltinValueKind::AutoDiffAllocateSubcontext:
case BuiltinValueKind::AutoDiffAllocateSubcontextWithType:
return getAutoDiffAllocateSubcontext(Context, Id);
}

Expand Down
16 changes: 9 additions & 7 deletions lib/IRGen/GenBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,9 +1307,10 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
return;
}

if (Builtin.ID == BuiltinValueKind::AutoDiffCreateLinearMapContext) {
auto topLevelSubcontextSize = args.claimNext();
out.add(emitAutoDiffCreateLinearMapContext(IGF, topLevelSubcontextSize)
if (Builtin.ID == BuiltinValueKind::AutoDiffCreateLinearMapContextWithType) {
auto topLevelSubcontextMetaType = args.claimNext();
out.add(emitAutoDiffCreateLinearMapContextWithType(
IGF, topLevelSubcontextMetaType)
.getAddress());
return;
}
Expand All @@ -1322,12 +1323,13 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
return;
}

if (Builtin.ID == BuiltinValueKind::AutoDiffAllocateSubcontext) {
if (Builtin.ID == BuiltinValueKind::AutoDiffAllocateSubcontextWithType) {
Address allocatorAddr(args.claimNext(), IGF.IGM.RefCountedStructTy,
IGF.IGM.getPointerAlignment());
auto size = args.claimNext();
out.add(
emitAutoDiffAllocateSubcontext(IGF, allocatorAddr, size).getAddress());
auto subcontextMetatype = args.claimNext();
out.add(emitAutoDiffAllocateSubcontextWithType(IGF, allocatorAddr,
subcontextMetatype)
.getAddress());
return;
}

Expand Down
20 changes: 12 additions & 8 deletions lib/IRGen/GenCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5483,11 +5483,13 @@ IRGenFunction::getFunctionPointerForResumeIntrinsic(llvm::Value *resume) {
return fnPtr;
}

Address irgen::emitAutoDiffCreateLinearMapContext(
IRGenFunction &IGF, llvm::Value *topLevelSubcontextSize) {
Address irgen::emitAutoDiffCreateLinearMapContextWithType(
IRGenFunction &IGF, llvm::Value *topLevelSubcontextMetatype) {
topLevelSubcontextMetatype = IGF.Builder.CreateBitCast(
topLevelSubcontextMetatype, IGF.IGM.TypeMetadataPtrTy);
auto *call = IGF.Builder.CreateCall(
IGF.IGM.getAutoDiffCreateLinearMapContextFunctionPointer(),
{topLevelSubcontextSize});
IGF.IGM.getAutoDiffCreateLinearMapContextWithTypeFunctionPointer(),
{topLevelSubcontextMetatype});
call->setDoesNotThrow();
call->setCallingConv(IGF.IGM.SwiftCC);
return Address(call, IGF.IGM.RefCountedStructTy,
Expand All @@ -5504,11 +5506,13 @@ Address irgen::emitAutoDiffProjectTopLevelSubcontext(
return Address(call, IGF.IGM.Int8Ty, IGF.IGM.getPointerAlignment());
}

Address irgen::emitAutoDiffAllocateSubcontext(
IRGenFunction &IGF, Address context, llvm::Value *size) {
Address irgen::emitAutoDiffAllocateSubcontextWithType(
IRGenFunction &IGF, Address context, llvm::Value *subcontextMetatype) {
subcontextMetatype =
IGF.Builder.CreateBitCast(subcontextMetatype, IGF.IGM.TypeMetadataPtrTy);
auto *call = IGF.Builder.CreateCall(
IGF.IGM.getAutoDiffAllocateSubcontextFunctionPointer(),
{context.getAddress(), size});
IGF.IGM.getAutoDiffAllocateSubcontextWithTypeFunctionPointer(),
{context.getAddress(), subcontextMetatype});
call->setDoesNotThrow();
call->setCallingConv(IGF.IGM.SwiftCC);
return Address(call, IGF.IGM.Int8Ty, IGF.IGM.getPointerAlignment());
Expand Down
11 changes: 7 additions & 4 deletions lib/IRGen/GenCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,15 @@ namespace irgen {
CanSILFunctionType fnType, Explosion &result,
Explosion &error);

Address emitAutoDiffCreateLinearMapContext(
IRGenFunction &IGF, llvm::Value *topLevelSubcontextSize);
Address emitAutoDiffCreateLinearMapContextWithType(
IRGenFunction &IGF, llvm::Value *topLevelSubcontextMetatype);

Address emitAutoDiffProjectTopLevelSubcontext(
IRGenFunction &IGF, Address context);
Address emitAutoDiffAllocateSubcontext(
IRGenFunction &IGF, Address context, llvm::Value *size);

Address
emitAutoDiffAllocateSubcontextWithType(IRGenFunction &IGF, Address context,
llvm::Value *subcontextMetatype);

FunctionPointer getFunctionPointerForDispatchCall(IRGenModule &IGM,
const FunctionPointer &fn);
Expand Down
3 changes: 1 addition & 2 deletions lib/IRGen/GenMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2586,8 +2586,7 @@ void irgen::emitLazyTypeContextDescriptor(IRGenModule &IGM,
IGM.Context.LangOpts.hasFeature(
Feature::LayoutStringValueWitnessesInstantiation) &&
IGM.getOptions().EnableLayoutStringValueWitnessesInstantiation) {
hasLayoutString |= requiresForeignTypeMetadata(type) ||
needsSingletonMetadataInitialization(IGM, type) ||
hasLayoutString |= needsSingletonMetadataInitialization(IGM, type) ||
(type->isGenericContext() && !isa<FixedTypeInfo>(ti));
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/IRGen/GenStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,10 +919,10 @@ namespace {
field.getTypeInfo().buildTypeLayoutEntry(IGM, fieldTy, useStructLayouts));
}

if (fields.size() == 1 && isFixedSize() &&
getBestKnownAlignment() == *fields[0]->fixedAlignment(IGM)) {
return fields[0];
}
// if (fields.size() == 1 && isFixedSize() &&
// getBestKnownAlignment() == *fields[0]->fixedAlignment(IGM)) {
// return fields[0];
// }

return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
fields, T, getBestKnownAlignment().getValue(), *this);
Expand Down
15 changes: 11 additions & 4 deletions lib/IRGen/TypeLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class LayoutStringBuilder {
RefCounting op;
op.kind = RefCountingKind::SinglePayloadEnumFN;
op.singlePayloadEnumFN.tagFn = tagFn;
op.singlePayloadEnumSimple.extraTagByteCount = extraTagByteCount;
op.singlePayloadEnumFN.extraTagByteCount = extraTagByteCount;
op.singlePayloadEnumFN.payload = payload;
refCountings.push_back(op);
}
Expand Down Expand Up @@ -360,12 +360,19 @@ class LayoutStringBuilder {
break;
}

default: {
case RefCountingKind::Existential: {
uint64_t op = (static_cast<uint64_t>(refCounting.kind) << 56) | skip;
B.addInt64(op);
refCountBytes += sizeof(uint64_t);
skip = refCounting.size - getFixedBufferSize(IGM).getValue();
break;
}

skip = refCounting.size;
default: {
uint64_t op = (static_cast<uint64_t>(refCounting.kind) << 56) | skip;
B.addInt64(op);
refCountBytes += sizeof(uint64_t);
skip = refCounting.size - IGM.getPointerSize().getValue();
break;
}
}
Expand Down Expand Up @@ -1734,7 +1741,7 @@ AlignedGroupEntry::layoutString(IRGenModule &IGM,

bool AlignedGroupEntry::refCountString(IRGenModule &IGM, LayoutStringBuilder &B,
GenericSignature genericSig) const {
if (!isFixedSize(IGM)) {
if (!isFixedSize(IGM) || ty.isMoveOnly()) {
return false;
}

Expand Down
5 changes: 2 additions & 3 deletions lib/SIL/IR/OperandOwnership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, InitializeDistributedRemoteActor)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse,
InitializeNonDefaultDistributedActor)

BUILTIN_OPERAND_OWNERSHIP(PointerEscape, AutoDiffAllocateSubcontext)
BUILTIN_OPERAND_OWNERSHIP(PointerEscape, AutoDiffAllocateSubcontextWithType)
BUILTIN_OPERAND_OWNERSHIP(PointerEscape, AutoDiffProjectTopLevelSubcontext)

// FIXME: ConvertTaskToJob is documented as taking NativePointer. It's operand's
Expand All @@ -956,8 +956,7 @@ BUILTIN_OPERAND_OWNERSHIP(BitwiseEscape, BuildComplexEqualitySerialExecutorRef)
BUILTIN_OPERAND_OWNERSHIP(BitwiseEscape, BuildDefaultActorExecutorRef)
BUILTIN_OPERAND_OWNERSHIP(BitwiseEscape, BuildMainActorExecutorRef)

BUILTIN_OPERAND_OWNERSHIP(TrivialUse, AutoDiffCreateLinearMapContext)

BUILTIN_OPERAND_OWNERSHIP(TrivialUse, AutoDiffCreateLinearMapContextWithType)
#undef BUILTIN_OPERAND_OWNERSHIP

#define SHOULD_NEVER_VISIT_BUILTIN(ID) \
Expand Down
4 changes: 2 additions & 2 deletions lib/SIL/IR/ValueOwnership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ CONSTANT_OWNERSHIP_BUILTIN(None, InitializeDefaultActor)
CONSTANT_OWNERSHIP_BUILTIN(None, DestroyDefaultActor)
CONSTANT_OWNERSHIP_BUILTIN(None, InitializeDistributedRemoteActor)
CONSTANT_OWNERSHIP_BUILTIN(None, InitializeNonDefaultDistributedActor)
CONSTANT_OWNERSHIP_BUILTIN(Owned, AutoDiffCreateLinearMapContext)
CONSTANT_OWNERSHIP_BUILTIN(Owned, AutoDiffCreateLinearMapContextWithType)
CONSTANT_OWNERSHIP_BUILTIN(None, AutoDiffProjectTopLevelSubcontext)
CONSTANT_OWNERSHIP_BUILTIN(None, AutoDiffAllocateSubcontext)
CONSTANT_OWNERSHIP_BUILTIN(None, AutoDiffAllocateSubcontextWithType)
CONSTANT_OWNERSHIP_BUILTIN(None, GetCurrentExecutor)
CONSTANT_OWNERSHIP_BUILTIN(None, ResumeNonThrowingContinuationReturning)
CONSTANT_OWNERSHIP_BUILTIN(None, ResumeThrowingContinuationReturning)
Expand Down
4 changes: 2 additions & 2 deletions lib/SIL/Utils/MemAccessUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2567,8 +2567,8 @@ static void visitBuiltinAddress(BuiltinInst *builtin,
case BuiltinValueKind::CancelAsyncTask:
case BuiltinValueKind::CreateAsyncTask:
case BuiltinValueKind::CreateAsyncTaskInGroup:
case BuiltinValueKind::AutoDiffCreateLinearMapContext:
case BuiltinValueKind::AutoDiffAllocateSubcontext:
case BuiltinValueKind::AutoDiffCreateLinearMapContextWithType:
case BuiltinValueKind::AutoDiffAllocateSubcontextWithType:
case BuiltinValueKind::InitializeDefaultActor:
case BuiltinValueKind::InitializeDistributedRemoteActor:
case BuiltinValueKind::InitializeNonDefaultDistributedActor:
Expand Down
16 changes: 7 additions & 9 deletions lib/SILGen/SILGenBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1708,16 +1708,15 @@ static ManagedValue emitBuiltinHopToActor(SILGenFunction &SGF, SILLocation loc,
return ManagedValue::forObjectRValueWithoutOwnership(SGF.emitEmptyTuple(loc));
}

static ManagedValue emitBuiltinAutoDiffCreateLinearMapContext(
static ManagedValue emitBuiltinAutoDiffCreateLinearMapContextWithType(
SILGenFunction &SGF, SILLocation loc, SubstitutionMap subs,
ArrayRef<ManagedValue> args, SGFContext C) {
ASTContext &ctx = SGF.getASTContext();
auto *builtinApply = SGF.B.createBuiltin(
loc,
ctx.getIdentifier(
getBuiltinName(BuiltinValueKind::AutoDiffCreateLinearMapContext)),
SILType::getNativeObjectType(ctx),
subs,
ctx.getIdentifier(getBuiltinName(
BuiltinValueKind::AutoDiffCreateLinearMapContextWithType)),
SILType::getNativeObjectType(ctx), subs,
/*args*/ {args[0].getValue()});
return SGF.emitManagedRValueWithCleanup(builtinApply);
}
Expand All @@ -1736,16 +1735,15 @@ static ManagedValue emitBuiltinAutoDiffProjectTopLevelSubcontext(
return ManagedValue::forObjectRValueWithoutOwnership(builtinApply);
}

static ManagedValue emitBuiltinAutoDiffAllocateSubcontext(
static ManagedValue emitBuiltinAutoDiffAllocateSubcontextWithType(
SILGenFunction &SGF, SILLocation loc, SubstitutionMap subs,
ArrayRef<ManagedValue> args, SGFContext C) {
ASTContext &ctx = SGF.getASTContext();
auto *builtinApply = SGF.B.createBuiltin(
loc,
ctx.getIdentifier(
getBuiltinName(BuiltinValueKind::AutoDiffAllocateSubcontext)),
SILType::getRawPointerType(ctx),
subs,
getBuiltinName(BuiltinValueKind::AutoDiffAllocateSubcontextWithType)),
SILType::getRawPointerType(ctx), subs,
/*args*/ {args[0].borrow(SGF, loc).getValue(), args[1].getValue()});
return ManagedValue::forObjectRValueWithoutOwnership(builtinApply);
}
Expand Down
Loading