Skip to content

Commit 360d1d3

Browse files
authored
Merge pull request #17158 from aschwaighofer/cast_optimizer_change_doc
2 parents 294ffc7 + d6b13f9 commit 360d1d3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/SILOptimizer/Utils/CastOptimizer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,8 @@ static bool optimizeStaticallyKnownProtocolConformance(
14341434
SourceType, Conformances);
14351435
auto Projection =
14361436
B.createProjectExistentialBox(Loc, Src->getType(), AllocBox);
1437+
// This needs to be a copy_addr (for now) because we must handle
1438+
// address-only types.
14371439
B.createCopyAddr(Loc, Src, Projection, IsTake, IsInitialization);
14381440
B.createStore(Loc, AllocBox, Dest,
14391441
swift::StoreOwnershipQualifier::Unqualified);

test/SILOptimizer/sil_combine_objc_bridge.sil

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ enum AddressOnlyError : Error {
202202
case none
203203
}
204204

205+
// Test that we emit a copy_addr for the address-only value initialization.
206+
205207
// CHECK-LABEL: sil @unconditional_checked_cast_addr_address_only_type
206208
// CHECK: alloc_stack $Error
207209
// CHECK: alloc_stack $AddressOnlyError

0 commit comments

Comments
 (0)