Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Mandatory/LowerHopToActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ SILValue LowerHopToActor::emitGetExecutor(SILBuilderWithScope &B,
if (auto wrappedActor = actorType->getOptionalObjectType()) {
assert(makeOptional);

if (B.hasOwnership() && actor->getOwnershipKind() == OwnershipKind::Owned) {
if (B.hasOwnership() && actor->getOwnershipKind() != OwnershipKind::Guaranteed) {
actor = B.createBeginBorrow(loc, actor);
needEndBorrow = true;
}
Expand Down
14 changes: 14 additions & 0 deletions test/SILOptimizer/lower_hop_to_actor.sil
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,17 @@ bb0(%0 : @guaranteed $Optional<any Actor>):
return %r
}

// CHECK-LABEL: sil [ossa] @optional_none :
// CHECK: %0 = enum
// CHECK-NEXT: %1 = begin_borrow %0
// CHECK-NEXT: switch_enum %1
// CHECK: mark_dependence
// CHECK-NEXT: end_borrow %1
// CHECKL: } // end sil function '@optional_none'
sil [ossa] @optional_none : $@convention(thin) @async () -> () {
bb0:
%0 = enum $Optional<any Actor>, #Optional.none!enumelt
hop_to_executor %0
%r = tuple ()
return %r
}