@@ -403,6 +403,7 @@ impl Conflicts {
403
403
. iterate_to_fixpoint ( )
404
404
. into_results_cursor ( body) ;
405
405
406
+ let mut reachable = None ;
406
407
dump_mir (
407
408
tcx,
408
409
None ,
@@ -411,15 +412,18 @@ impl Conflicts {
411
412
source,
412
413
body,
413
414
|pass_where, w| {
415
+ let reachable =
416
+ reachable. get_or_insert_with ( || traversal:: reachable_as_bitset ( body) ) ;
417
+
414
418
match pass_where {
415
- PassWhere :: BeforeLocation ( loc) => {
419
+ PassWhere :: BeforeLocation ( loc) if reachable . contains ( loc . block ) => {
416
420
init. seek_before_primary_effect ( loc) ;
417
421
live. seek_after_primary_effect ( loc) ;
418
422
419
423
writeln ! ( w, " // init: {:?}" , init. get( ) ) ?;
420
424
writeln ! ( w, " // live: {:?}" , live. get( ) ) ?;
421
425
}
422
- PassWhere :: AfterTerminator ( bb) => {
426
+ PassWhere :: AfterTerminator ( bb) if reachable . contains ( bb ) => {
423
427
let loc = body. terminator_loc ( bb) ;
424
428
init. seek_after_primary_effect ( loc) ;
425
429
live. seek_before_primary_effect ( loc) ;
@@ -428,7 +432,7 @@ impl Conflicts {
428
432
writeln ! ( w, " // live: {:?}" , live. get( ) ) ?;
429
433
}
430
434
431
- PassWhere :: BeforeBlock ( bb) => {
435
+ PassWhere :: BeforeBlock ( bb) if reachable . contains ( bb ) => {
432
436
init. seek_to_block_start ( bb) ;
433
437
live. seek_to_block_start ( bb) ;
434
438
@@ -437,6 +441,16 @@ impl Conflicts {
437
441
}
438
442
439
443
PassWhere :: BeforeCFG | PassWhere :: AfterCFG | PassWhere :: AfterLocation ( _) => { }
444
+
445
+ PassWhere :: BeforeLocation ( _) | PassWhere :: AfterTerminator ( _) => {
446
+ writeln ! ( w, " // init: <unreachable>" ) ?;
447
+ writeln ! ( w, " // live: <unreachable>" ) ?;
448
+ }
449
+
450
+ PassWhere :: BeforeBlock ( _) => {
451
+ writeln ! ( w, " // init: <unreachable>" ) ?;
452
+ writeln ! ( w, " // live: <unreachable>" ) ?;
453
+ }
440
454
}
441
455
442
456
Ok ( ( ) )
0 commit comments