}
void ScalarEvolution::forgetLoop(const Loop *L) {
- // Drop any stored trip count value.
- auto RemoveLoopFromBackedgeMap =
- [](DenseMap<const Loop *, BackedgeTakenInfo> &Map, const Loop *L) {
- auto BTCPos = Map.find(L);
- if (BTCPos != Map.end()) {
- BTCPos->second.clear();
- Map.erase(BTCPos);
- }
- };
-
SmallVector<const Loop *, 16> LoopWorklist(1, L);
SmallVector<Instruction *, 32> Worklist;
SmallPtrSet<Instruction *, 16> Visited;
while (!LoopWorklist.empty()) {
auto *CurrL = LoopWorklist.pop_back_val();
- RemoveLoopFromBackedgeMap(BackedgeTakenCounts, CurrL);
- RemoveLoopFromBackedgeMap(PredicatedBackedgeTakenCounts, CurrL);
+ // Drop any stored trip count value.
+ BackedgeTakenCounts.erase(CurrL);
+ PredicatedBackedgeTakenCounts.erase(CurrL);
// Drop information about predicated SCEV rewrites for this loop.
for (auto I = PredicatedSCEVRewrites.begin();
"No point in having a non-constant max backedge taken count!");
}
-/// Invalidate this result and free the ExitNotTakenInfo array.
-void ScalarEvolution::BackedgeTakenInfo::clear() {
- ExitNotTaken.clear();
-}
-
/// Compute the number of times the backedge of the specified loop will execute.
ScalarEvolution::BackedgeTakenInfo
ScalarEvolution::computeBackedgeTakenCount(const Loop *L,
ExprValueMap.clear();
ValueExprMap.clear();
HasRecMap.clear();
-
- // Free any extra memory created for ExitNotTakenInfo in the unlikely event
- // that a loop had multiple computable exits.
- for (auto &BTCI : BackedgeTakenCounts)
- BTCI.second.clear();
- for (auto &BTCI : PredicatedBackedgeTakenCounts)
- BTCI.second.clear();
+ BackedgeTakenCounts.clear();
+ PredicatedBackedgeTakenCounts.clear();
assert(PendingLoopPredicates.empty() && "isImpliedCond garbage");
assert(PendingPhiRanges.empty() && "getRangeRef garbage");
[S, this](DenseMap<const Loop *, BackedgeTakenInfo> &Map) {
for (auto I = Map.begin(), E = Map.end(); I != E;) {
BackedgeTakenInfo &BEInfo = I->second;
- if (BEInfo.hasOperand(S, this)) {
- BEInfo.clear();
+ if (BEInfo.hasOperand(S, this))
Map.erase(I++);
- } else
+ else
++I;
}
};