[llvm] ec184dd - [LVI] Convert some checks to assertions; NFC
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 15:11:30 PDT 2020
Author: Nikita Popov
Date: 2020-03-24T23:11:13+01:00
New Revision: ec184dd548f7832d09d3c6354a6d9d3db6cacc65
URL: https://github.com/llvm/llvm-project/commit/ec184dd548f7832d09d3c6354a6d9d3db6cacc65
DIFF: https://github.com/llvm/llvm-project/commit/ec184dd548f7832d09d3c6354a6d9d3db6cacc65.diff
LOG: [LVI] Convert some checks to assertions; NFC
solveBlockValue() should only be called if the value isn't cached
yet. Similarly, it does not make sense to "solve" a constant.
Added:
Modified:
llvm/lib/Analysis/LazyValueInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 4e757ba6c19a..296f27799b94 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -596,19 +596,9 @@ static ValueLatticeElement getFromRangeMetadata(Instruction *BBI) {
}
bool LazyValueInfoImpl::solveBlockValue(Value *Val, BasicBlock *BB) {
- if (isa<Constant>(Val))
- return true;
-
- if (TheCache.hasCachedValueInfo(Val, BB)) {
- // If we have a cached value, use that.
- LLVM_DEBUG(dbgs() << " reuse BB '" << BB->getName() << "' val="
- << TheCache.getCachedValueInfo(Val, BB) << '\n');
-
- // Since we're reusing a cached value, we don't need to update the
- // OverDefinedCache. The cache will have been properly updated whenever the
- // cached value was inserted.
- return true;
- }
+ assert(!isa<Constant>(Val) && "Value should not be constant");
+ assert(!TheCache.hasCachedValueInfo(Val, BB) &&
+ "Value should not be in cache");
// Hold off inserting this value into the Cache in case we have to return
// false and come back later.
More information about the llvm-commits
mailing list