Skip to content

Commit b52a117

Browse files
committed
---
yaml --- r: 346085 b: refs/heads/master c: 2a45687 h: refs/heads/master i: 346083: 469917f
1 parent d4a1261 commit b52a117

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 24755cceade872e7a36addd3b459c141d1571ddd
2+
refs/heads/master: 2a45687d60bea939d8090526759216635bf7fd91
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/IRGen/LoadableByAddress.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,8 +2453,10 @@ void LoadableByAddress::recreateSingleApply(SILInstruction *applyInst) {
24532453
SILValue oldValue = oldYieldedValues[i];
24542454
SILValue newValue = newYieldedValues[i];
24552455

2456-
// For now, just replace the value with an immediate load.
2457-
if (oldValue->getType() != newValue->getType()) {
2456+
// For now, just replace the value with an immediate load if the old value
2457+
// was direct.
2458+
if (oldValue->getType() != newValue->getType() &&
2459+
!oldValue->getType().isAddress()) {
24582460
LoadOwnershipQualifier ownership;
24592461
if (!F->hasQualifiedOwnership()) {
24602462
ownership = LoadOwnershipQualifier::Unqualified;

trunk/test/IRGen/big_types_coroutine.sil

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -loadable-address -enable-sil-verify-all %s | %FileCheck %s
1+
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -loadable-address -enable-sil-verify-all %s | %FileCheck %s
22

33
// REQUIRES: CPU=x86_64
44
// REQUIRES: OS=macosx
@@ -57,8 +57,8 @@ unwind:
5757
// CHECK-NEXT: [[CORO:%.*]] = function_ref @test_yield_big : $@yield_once @convention(thin) () -> @yields @in_constant BigStruct
5858
// CHECK-NEXT: ([[ADDR:%.*]], [[TOKEN:%.*]]) = begin_apply [[CORO]]()
5959
// TODO: this isn't very efficient
60-
// CHECK-NEXT: [[T0:%.*]] = load [trivial] [[ADDR]] : $*BigStruct
61-
// CHECK-NEXT: store [[T0]] to [trivial] [[TEMP]] : $*BigStruct
60+
// CHECK-NEXT: [[T0:%.*]] = load [[ADDR]] : $*BigStruct
61+
// CHECK-NEXT: store [[T0]] to [[TEMP]] : $*BigStruct
6262
// CHECK-NEXT: // function_ref
6363
// CHECK-NEXT: [[USE:%.*]] = function_ref @use_big_struct : $@convention(thin) (@in_constant BigStruct) -> ()
6464
// CHECK-NEXT: apply [[USE]]([[TEMP]])
@@ -76,3 +76,24 @@ entry:
7676
%ret = tuple ()
7777
return %ret : $()
7878
}
79+
80+
sil @yield_fun_ptr2 : $@yield_once @convention(thin) () -> @yields @inout Optional<@callee_guaranteed (@guaranteed BigStruct) -> ()>
81+
82+
// CHECK-LABEL: sil @yield_funptr : $
83+
// CHECK: (%1, %2) = begin_apply %0() : $@yield_once @convention(thin) () -> @yields @inout Optional<@callee_guaranteed (@in_guaranteed BigStruct) -> ()>
84+
// CHECK: yield %1
85+
sil @yield_funptr : $@yield_once @convention(thin) () -> @yields @inout Optional<@callee_guaranteed (@guaranteed BigStruct) -> ()> {
86+
bb0:
87+
%2 = function_ref @yield_fun_ptr2 : $@yield_once @convention(thin) () -> @yields @inout Optional<@callee_guaranteed (@guaranteed BigStruct) -> ()>
88+
(%3, %4) = begin_apply %2() : $@yield_once @convention(thin) () -> @yields @inout Optional<@callee_guaranteed (@guaranteed BigStruct) -> ()>
89+
yield %3 : $*Optional<@callee_guaranteed (@guaranteed BigStruct) -> ()>, resume bb1, unwind bb2
90+
91+
bb1:
92+
end_apply %4
93+
%7 = tuple ()
94+
return %7 : $()
95+
96+
bb2:
97+
abort_apply %4
98+
unwind
99+
}

0 commit comments

Comments
 (0)