File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
include/swift/SILOptimizer/Utils Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,13 @@ class ReachableBlocks {
47
47
// / Populate `visited` with the blocks reachable in the function.
48
48
void compute ();
49
49
50
+ // / Whether `block` is reachable from the entry block.
51
+ bool isReachable (SILBasicBlock *block) const {
52
+ assert (isComputed);
53
+ return isVisited (block);
54
+ }
55
+
56
+ private:
50
57
// / Invoke \p visitor for each reachable block in \p f in worklist order (at
51
58
// / least one predecessor has been visited--defs are always visited before
52
59
// / uses except for phi-type block args). The \p visitor takes a block
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ bool swift::removeUnreachableBlocks(SILFunction &f) {
70
70
bool changed = false ;
71
71
for (auto ii = std::next (f.begin ()), end = f.end (); ii != end;) {
72
72
auto *bb = &*ii++;
73
- if (!reachable.isVisited (bb)) {
73
+ if (!reachable.isReachable (bb)) {
74
74
bb->removeDeadBlock ();
75
75
changed = true ;
76
76
}
You can’t perform that action at this time.
0 commit comments