[llvm] ef87e66 - [LVI] Assert that only one value is pushed (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 01:29:53 PST 2024


Author: Nikita Popov
Date: 2024-01-10T10:29:45+01:00
New Revision: ef87e6643ea24103e884a71ec2f5cd2e13e0b454

URL: https://github.com/llvm/llvm-project/commit/ef87e6643ea24103e884a71ec2f5cd2e13e0b454
DIFF: https://github.com/llvm/llvm-project/commit/ef87e6643ea24103e884a71ec2f5cd2e13e0b454.diff

LOG: [LVI] Assert that only one value is pushed (NFC)

Added: 
    

Modified: 
    llvm/lib/Analysis/LazyValueInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 360fc594ef7ca3..b948eb6ebd1266 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -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);
@@ -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!");
     }
   }
 }


        


More information about the llvm-commits mailing list