File tree Expand file tree Collapse file tree 3 files changed +31
-7
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 3 files changed +31
-7
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3
- refs/heads/master-next: 010a765a49b9c611dc141909d3df2b86da47f992
3
+ refs/heads/master-next: 528a07a261aef622f61ee434abc9df99115b4d17
4
4
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
5
5
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
6
6
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07
Original file line number Diff line number Diff line change @@ -143,9 +143,9 @@ bool GuaranteedARCOptsVisitor::visitStrongReleaseInst(StrongReleaseInst *SRI) {
143
143
auto *Inst = &*II;
144
144
++II;
145
145
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 ();
149
149
SRI->eraseFromParent ();
150
150
NumInstsEliminated += 2 ;
151
151
return true ;
@@ -198,9 +198,9 @@ bool GuaranteedARCOptsVisitor::visitReleaseValueInst(ReleaseValueInst *RVI) {
198
198
auto *Inst = &*II;
199
199
++II;
200
200
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 ();
204
204
RVI->eraseFromParent ();
205
205
NumInstsEliminated += 2 ;
206
206
return true ;
Original file line number Diff line number Diff line change @@ -158,3 +158,27 @@ bb0(%0 : $C, %1 : $Builtin.Int32):
158
158
%9999 = tuple()
159
159
return %9999 : $()
160
160
}
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
+ }
You can’t perform that action at this time.
0 commit comments