Skip to content

Commit

Permalink
[LVI] Assert that only one value is pushed (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jan 10, 2024
1 parent 65a56a2 commit ef87e66
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llvm/lib/Analysis/LazyValueInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,13 @@ void LazyValueInfoImpl::solve() {
}
std::pair<BasicBlock *, Value *> e = BlockValueStack.back();
assert(BlockValueSet.count(e) && "Stack value should be in BlockValueSet!");
unsigned StackSize = BlockValueStack.size();
(void) StackSize;

if (solveBlockValue(e.second, e.first)) {
// The work item was completely processed.
assert(BlockValueStack.back() == e && "Nothing should have been pushed!");
assert(BlockValueStack.size() == StackSize &&
BlockValueStack.back() == e && "Nothing should have been pushed!");
#ifndef NDEBUG
std::optional<ValueLatticeElement> BBLV =
TheCache.getCachedValueInfo(e.second, e.first);
Expand All @@ -556,7 +559,8 @@ void LazyValueInfoImpl::solve() {
BlockValueSet.erase(e);
} else {
// More work needs to be done before revisiting.
assert(BlockValueStack.back() != e && "Stack should have been pushed!");
assert(BlockValueStack.size() == StackSize + 1 &&
"Exactly one element should have been pushed!");
}
}
}
Expand Down

0 comments on commit ef87e66

Please sign in to comment.