Skip to content

Commit 286efd7

Browse files
committed
---
yaml --- r: 349344 b: refs/heads/master-next c: 528a07a h: refs/heads/master
1 parent f3ff42a commit 286efd7

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 010a765a49b9c611dc141909d3df2b86da47f992
3+
refs/heads/master-next: 528a07a261aef622f61ee434abc9df99115b4d17
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/SILOptimizer/Mandatory/GuaranteedARCOpts.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ bool GuaranteedARCOptsVisitor::visitStrongReleaseInst(StrongReleaseInst *SRI) {
143143
auto *Inst = &*II;
144144
++II;
145145

146-
if (auto *SRA = dyn_cast<StrongRetainInst>(Inst)) {
147-
if (SRA->getOperand() == Operand) {
148-
SRA->eraseFromParent();
146+
if (isa<StrongRetainInst>(Inst) || isa<RetainValueInst>(Inst)) {
147+
if (Inst->getOperand(0) == Operand) {
148+
Inst->eraseFromParent();
149149
SRI->eraseFromParent();
150150
NumInstsEliminated += 2;
151151
return true;
@@ -198,9 +198,9 @@ bool GuaranteedARCOptsVisitor::visitReleaseValueInst(ReleaseValueInst *RVI) {
198198
auto *Inst = &*II;
199199
++II;
200200

201-
if (auto *SRA = dyn_cast<RetainValueInst>(Inst)) {
202-
if (SRA->getOperand() == Operand) {
203-
SRA->eraseFromParent();
201+
if (isa<RetainValueInst>(Inst) || isa<StrongRetainInst>(Inst)) {
202+
if (Inst->getOperand(0) == Operand) {
203+
Inst->eraseFromParent();
204204
RVI->eraseFromParent();
205205
NumInstsEliminated += 2;
206206
return true;

branches/master-next/test/SILOptimizer/guaranteed_arc_opts_qualified.sil

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,27 @@ bb0(%0 : $C, %1 : $Builtin.Int32):
158158
%9999 = tuple()
159159
return %9999 : $()
160160
}
161+
162+
// CHECK-LABEL: sil @mixed_test_1 : $@convention(thin) (Builtin.NativeObject, Builtin.NativeObject) -> () {
163+
// CHECK-NOT: retain
164+
// CHECK-NOT: release
165+
// CHECK: } // end sil function 'mixed_test_1'
166+
sil @mixed_test_1 : $@convention(thin) (Builtin.NativeObject, Builtin.NativeObject) -> () {
167+
bb0(%0 : $Builtin.NativeObject, %1 : $Builtin.NativeObject):
168+
strong_retain %0 : $Builtin.NativeObject
169+
release_value %0 : $Builtin.NativeObject
170+
%9999 = tuple()
171+
return %9999 : $()
172+
}
173+
174+
// CHECK-LABEL: sil @mixed_test_2 : $@convention(thin) (Builtin.NativeObject, Builtin.NativeObject) -> () {
175+
// CHECK-NOT: retain
176+
// CHECK-NOT: release
177+
// CHECK: } // end sil function 'mixed_test_2'
178+
sil @mixed_test_2 : $@convention(thin) (Builtin.NativeObject, Builtin.NativeObject) -> () {
179+
bb0(%0 : $Builtin.NativeObject, %1 : $Builtin.NativeObject):
180+
retain_value %0 : $Builtin.NativeObject
181+
strong_release %0 : $Builtin.NativeObject
182+
%9999 = tuple()
183+
return %9999 : $()
184+
}

0 commit comments

Comments
 (0)