[llvm] [AssumptionCache] Fix removeAffectedValues() when value is repeated in AssumeInst (PR #205275)
Nikolas Klauser via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 23 23:54:33 PDT 2026
================
@@ -129,15 +146,28 @@ void AssumptionCache::removeAffectedValues(AssumeInst *CI) {
if (Elem.Assume == CI) {
Found = true;
Elem.Assume = nullptr;
+
+ ExpectedMatches[AV.Assume]--;
+ assert(ExpectedMatches[AV.Assume] >= 0);
+ // After ExpectedMatches[AV.Assume] == 0, we still need to iterate
+ // through this loop to determine the value of HasNonnull, to avoid
+ // prematurely calling AffectedValues.erase(AVI).
}
HasNonnull |= !!Elem.Assume;
if (HasNonnull && Found)
break;
}
- assert(Found && "already unregistered or incorrect cache state");
+
+ if (ExpectedMatches[AV.Assume] > 0)
+ assert(Found && "already unregistered or incorrect cache state");
----------------
philnik777 wrote:
```suggestion
assert(ExpectedMatches[AV.Assume] == 0 || Found && "already unregistered or incorrect cache state");
```
https://github.com/llvm/llvm-project/pull/205275
More information about the llvm-commits
mailing list