Skip to content

Commit 81a09b3

Browse files
committed
When using a store_borrow for borrowed things, make sure to only store_borrow if we are using lowered addresses.
When opaque values are enabled, we do not need this store_borrow. This was caught by the following tests: Swift(macosx-x86_64) :: SILGen/opaque_values_silgen.swift Swift(macosx-x86_64) :: SILGen/opaque_values_silgen_resilient.swift
1 parent e76f3f9 commit 81a09b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4267,7 +4267,8 @@ static void emitBorrowedLValueRecursive(SILGenFunction &SGF,
42674267

42684268
// If we have an indirect_guaranteed argument, move this using store_borrow
42694269
// into an alloc_stack.
4270-
if (param.isIndirectInGuaranteed() && value.getType().isObject()) {
4270+
if (SGF.silConv.useLoweredAddresses() &&
4271+
param.isIndirectInGuaranteed() && value.getType().isObject()) {
42714272
SILValue alloca = SGF.emitTemporaryAllocation(loc, value.getType());
42724273
value = SGF.emitFormalEvaluationManagedStoreBorrow(loc, value.getValue(),
42734274
alloca);

0 commit comments

Comments
 (0)