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
4 changes: 3 additions & 1 deletion lib/SILGen/SILGenLValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5240,7 +5240,9 @@ void SILGenFunction::emitSemanticStore(SILLocation loc,
assert(!silConv.useLoweredAddresses() ||
(dest->getType().isAddressOnly(F) == rvalue->getType().isAddress()));
if (rvalue->getType().isAddress()) {
B.createCopyAddr(loc, rvalue, dest, IsTake, isInit);
B.createCopyAddr(loc, rvalue, dest,
rvalue->getType().isTrivial(F) ? IsNotTake : IsTake,
isInit);
} else {
emitUnloweredStoreOfCopy(B, loc, rvalue, dest, isInit);
}
Expand Down
15 changes: 15 additions & 0 deletions test/SILGen/trivial_address_only_switch.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %target-swift-emit-silgen -verify -disable-availability-checking %s

public enum StreamYieldResult<let count: Int>: Sendable {
case literal(buffer: InlineArray<count, UInt8>)
case end(buffer: InlineArray<count, UInt8>, endIndex: Int)

public func buffer() -> InlineArray<count, UInt8> {
switch self {
case .literal(let b):
return b
case .end(let b, _):
return b
}
}
}
2 changes: 1 addition & 1 deletion test/SILGen/variadic-generic-tuples.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public struct Container<each T> {
// Finally, the actual assignment.
// CHECK-NEXT: [[ACCESS:%.*]] = begin_access [modify] [unknown] %1 :
// CHECK-NEXT: [[FIELD:%.*]] = struct_element_addr [[ACCESS]] : $*Container<repeat each T>, #Container.storage
// CHECK-NEXT: copy_addr [take] [[COPY2]] to [[FIELD]] : $*(repeat Stored<each T>)
// CHECK-NEXT: copy_addr [[COPY2]] to [[FIELD]] : $*(repeat Stored<each T>)
// CHECK-NEXT: end_access [[ACCESS]]
// Clean up.
// CHECK-NEXT: dealloc_stack [[COPY2]]
Expand Down