Skip to content

Commit ef87e66

Browse files
committed
[LVI] Assert that only one value is pushed (NFC)
1 parent 65a56a2 commit ef87e66

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/lib/Analysis/LazyValueInfo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,13 @@ void LazyValueInfoImpl::solve() {
539539
}
540540
std::pair<BasicBlock *, Value *> e = BlockValueStack.back();
541541
assert(BlockValueSet.count(e) && "Stack value should be in BlockValueSet!");
542+
unsigned StackSize = BlockValueStack.size();
543+
(void) StackSize;
542544

543545
if (solveBlockValue(e.second, e.first)) {
544546
// The work item was completely processed.
545-
assert(BlockValueStack.back() == e && "Nothing should have been pushed!");
547+
assert(BlockValueStack.size() == StackSize &&
548+
BlockValueStack.back() == e && "Nothing should have been pushed!");
546549
#ifndef NDEBUG
547550
std::optional<ValueLatticeElement> BBLV =
548551
TheCache.getCachedValueInfo(e.second, e.first);
@@ -556,7 +559,8 @@ void LazyValueInfoImpl::solve() {
556559
BlockValueSet.erase(e);
557560
} else {
558561
// More work needs to be done before revisiting.
559-
assert(BlockValueStack.back() != e && "Stack should have been pushed!");
562+
assert(BlockValueStack.size() == StackSize + 1 &&
563+
"Exactly one element should have been pushed!");
560564
}
561565
}
562566
}

0 commit comments

Comments
 (0)