File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
lib/SILOptimizer/Transforms Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -717,6 +717,10 @@ void DSEContext::mergeSuccessorLiveIns(SILBasicBlock *BB) {
717
717
// dead for block with no successor.
718
718
BlockState *C = getBlockState (BB);
719
719
if (BB->succ_empty ()) {
720
+ if (isa<UnreachableInst>(BB->getTerminator ())) {
721
+ C->BBWriteSetOut .set ();
722
+ return ;
723
+ }
720
724
C->BBWriteSetOut |= C->BBDeallocateLocation ;
721
725
return ;
722
726
}
Original file line number Diff line number Diff line change @@ -291,6 +291,29 @@ bb3:
291
291
return %9999 : $()
292
292
}
293
293
294
+ // CHECK-LABEL: sil @handle_unreachable : $@convention(thin) (@inout Builtin.Int32) -> () {
295
+ // CHECK: bb0
296
+ // CHECK-NEXT: integer_literal
297
+ // CHECK-NEXT: cond_br
298
+ // CHECK: return
299
+ sil @handle_unreachable : $@convention(thin) (@inout Builtin.Int32) -> () {
300
+ bb0(%0 : $*Builtin.Int32):
301
+ %1 = integer_literal $Builtin.Int32, 0
302
+ store %1 to %0 : $*Builtin.Int32
303
+ cond_br undef, bb1, bb2
304
+
305
+ bb1:
306
+ unreachable
307
+
308
+ bb2:
309
+ br bb3
310
+
311
+ bb3:
312
+ store %1 to %0 : $*Builtin.Int32
313
+ %9999 = tuple()
314
+ return %9999 : $()
315
+ }
316
+
294
317
// CHECK-LABEL: sil @post_dominating_dead_store_partial : $@convention(thin) (@inout Builtin.Int32) -> () {
295
318
// CHECK: bb0(
296
319
// CHECK-NOT: {{ store}}
You can’t perform that action at this time.
0 commit comments