Skip to content

Commit 0614b3c

Browse files
[Analysis] Simplify code with DenseMap::operator[] (NFC) (#111331)
1 parent 40f0f7b commit 0614b3c

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

llvm/lib/Analysis/BasicAliasAnalysis.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,8 @@ bool EarliestEscapeInfo::isNotCapturedBefore(const Value *Object,
219219
Instruction *EarliestCapture = FindEarliestCapture(
220220
Object, *const_cast<Function *>(DT.getRoot()->getParent()),
221221
/*ReturnCaptures=*/false, /*StoreCaptures=*/true, DT);
222-
if (EarliestCapture) {
223-
auto Ins = Inst2Obj.insert({EarliestCapture, {}});
224-
Ins.first->second.push_back(Object);
225-
}
222+
if (EarliestCapture)
223+
Inst2Obj[EarliestCapture].push_back(Object);
226224
Iter.first->second = EarliestCapture;
227225
}
228226

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,8 @@ void RuntimePointerChecking::groupChecks(
512512
unsigned TotalComparisons = 0;
513513

514514
DenseMap<Value *, SmallVector<unsigned>> PositionMap;
515-
for (unsigned Index = 0; Index < Pointers.size(); ++Index) {
516-
auto [It, _] = PositionMap.insert({Pointers[Index].PointerValue, {}});
517-
It->second.push_back(Index);
518-
}
515+
for (unsigned Index = 0; Index < Pointers.size(); ++Index)
516+
PositionMap[Pointers[Index].PointerValue].push_back(Index);
519517

520518
// We need to keep track of what pointers we've already seen so we
521519
// don't process them twice.

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,8 +1564,7 @@ static void insertFoldCacheEntry(
15641564
UserIDs.pop_back();
15651565
I.first->second = S;
15661566
}
1567-
auto R = FoldCacheUser.insert({S, {}});
1568-
R.first->second.push_back(ID);
1567+
FoldCacheUser[S].push_back(ID);
15691568
}
15701569

15711570
const SCEV *

0 commit comments

Comments
 (0)