File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
lib/SILOptimizer/Transforms Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ static bool seemsUseful(SILInstruction *I) {
55
55
isa<EndBorrowInst>(I))
56
56
return false ;
57
57
58
+ if (isa<UnconditionalCheckedCastInst>(I)) {
59
+ return false ;
60
+ }
61
+
58
62
// A load [copy] is okay to be DCE'ed if there are no useful dependencies
59
63
if (auto *load = dyn_cast<LoadInst>(I)) {
60
64
if (load->getOwnershipQualifier () == LoadOwnershipQualifier::Copy)
Original file line number Diff line number Diff line change @@ -270,3 +270,18 @@ bb0(%0 : $*Container):
270
270
%999 = tuple ()
271
271
return %999 : $()
272
272
}
273
+
274
+ class B {}
275
+
276
+ // CHECK-LABEL: sil @dead_unconditional_checked_cast
277
+ // CHECK-NOT: unconditional_checked_cast
278
+ // CHECK-LABEL: end sil function 'dead_unconditional_checked_cast'
279
+ sil @dead_unconditional_checked_cast : $@convention(thin) (B, B) -> () {
280
+ bb0(%0 : $B, %1: $B):
281
+ strong_retain %0: $B
282
+ apply undef() : $@convention(thin) () -> ()
283
+ %3 = unconditional_checked_cast %0 : $B to Builtin.NativeObject
284
+ strong_release %0: $B
285
+ %5 = tuple()
286
+ return %5 : $()
287
+ }
You can’t perform that action at this time.
0 commit comments