[llvm] c9f9be0 - [SCEV] Verify integrity of ValuesAtScopes and users (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 30 12:08:48 PST 2021
Author: Nikita Popov
Date: 2021-11-30T21:08:40+01:00
New Revision: c9f9be0381d1a3dee1304981ad52c0285638efca
URL: https://github.com/llvm/llvm-project/commit/c9f9be0381d1a3dee1304981ad52c0285638efca
DIFF: https://github.com/llvm/llvm-project/commit/c9f9be0381d1a3dee1304981ad52c0285638efca.diff
LOG: [SCEV] Verify integrity of ValuesAtScopes and users (NFC)
Make sure that ValuesAtScopes and ValuesAtScopesUsers are
consistent during SCEV verification.
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 10320d266d57..ece19099d65e 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -13098,7 +13098,7 @@ void ScalarEvolution::verify() const {
}
}
- // Verify intergity of SCEV users.
+ // Verify integrity of SCEV users.
for (const auto &S : UniqueSCEVs) {
SmallVector<const SCEV *, 4> Ops;
collectUniqueOps(&S, Ops);
@@ -13114,6 +13114,40 @@ void ScalarEvolution::verify() const {
std::abort();
}
}
+
+ // Verify integrity of ValuesAtScopes users.
+ for (const auto &ValueAndVec : ValuesAtScopes) {
+ const SCEV *Value = ValueAndVec.first;
+ for (const auto &LoopAndValueAtScope : ValueAndVec.second) {
+ const Loop *L = LoopAndValueAtScope.first;
+ const SCEV *ValueAtScope = LoopAndValueAtScope.second;
+ if (!isa<SCEVConstant>(ValueAtScope)) {
+ auto It = ValuesAtScopesUsers.find(ValueAtScope);
+ if (It != ValuesAtScopesUsers.end() &&
+ is_contained(It->second, std::make_pair(L, Value)))
+ continue;
+ dbgs() << "Value: " << *Value << ", Loop: " << *L << ", ValueAtScope: "
+ << ValueAtScope << " missing in ValuesAtScopesUsers\n";
+ std::abort();
+ }
+ }
+ }
+
+ for (const auto &ValueAtScopeAndVec : ValuesAtScopesUsers) {
+ const SCEV *ValueAtScope = ValueAtScopeAndVec.first;
+ for (const auto &LoopAndValue : ValueAtScopeAndVec.second) {
+ const Loop *L = LoopAndValue.first;
+ const SCEV *Value = LoopAndValue.second;
+ assert(!isa<SCEVConstant>(Value));
+ auto It = ValuesAtScopes.find(Value);
+ if (It != ValuesAtScopes.end() &&
+ is_contained(It->second, std::make_pair(L, ValueAtScope)))
+ continue;
+ dbgs() << "Value: " << *Value << ", Loop: " << *L << ", ValueAtScope: "
+ << ValueAtScope << " missing in ValuesAtScopes";
+ std::abort();
+ }
+ }
}
bool ScalarEvolution::invalidate(
More information about the llvm-commits
mailing list