Skip to content

Commit 9cc4a97

Browse files
committed
[BackwardReachability] Enforce correct API usage.
1 parent 3a9c801 commit 9cc4a97

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/swift/SILOptimizer/Analysis/Reachability.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class BackwardReachability {
6565
SILFunction *function;
6666
BlockReachability &reachableBlocks;
6767
BasicBlockWorklist cfgWorklist;
68+
bool solved = false;
6869

6970
public:
7071
BackwardReachability(SILFunction *function,
@@ -74,6 +75,7 @@ class BackwardReachability {
7475

7576
// Initialize data flow starting points before running solveBackward.
7677
void initLastUse(SILInstruction *lastUsePoint) {
78+
assert(!solved && "adding last use after solving!?");
7779
auto *lastUseBlock = lastUsePoint->getParent();
7880
auto *previous = lastUsePoint->getPreviousInstruction();
7981
if (!previous || canReachBlockBegin(previous)) {
@@ -93,6 +95,7 @@ class BackwardReachability {
9395
pushPreds(block);
9496
}
9597
}
98+
solved = true;
9699
}
97100

98101
protected:

0 commit comments

Comments
 (0)