[llvm] 0614b3c - [Analysis] Simplify code with DenseMap::operator[] (NFC) (#111331)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 7 07:00:49 PDT 2024
Author: Kazu Hirata
Date: 2024-10-07T07:00:45-07:00
New Revision: 0614b3cface2128c2e0f7e3415b54f5cdb75a02b
URL: https://github.com/llvm/llvm-project/commit/0614b3cface2128c2e0f7e3415b54f5cdb75a02b
DIFF: https://github.com/llvm/llvm-project/commit/0614b3cface2128c2e0f7e3415b54f5cdb75a02b.diff
LOG: [Analysis] Simplify code with DenseMap::operator[] (NFC) (#111331)
Added:
Modified:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index f471c0db11d3ef..1dcdad01f4c809 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -219,10 +219,8 @@ bool EarliestEscapeInfo::isNotCapturedBefore(const Value *Object,
Instruction *EarliestCapture = FindEarliestCapture(
Object, *const_cast<Function *>(DT.getRoot()->getParent()),
/*ReturnCaptures=*/false, /*StoreCaptures=*/true, DT);
- if (EarliestCapture) {
- auto Ins = Inst2Obj.insert({EarliestCapture, {}});
- Ins.first->second.push_back(Object);
- }
+ if (EarliestCapture)
+ Inst2Obj[EarliestCapture].push_back(Object);
Iter.first->second = EarliestCapture;
}
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index fe00ea0097a43a..d35bf6818d4379 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -512,10 +512,8 @@ void RuntimePointerChecking::groupChecks(
unsigned TotalComparisons = 0;
DenseMap<Value *, SmallVector<unsigned>> PositionMap;
- for (unsigned Index = 0; Index < Pointers.size(); ++Index) {
- auto [It, _] = PositionMap.insert({Pointers[Index].PointerValue, {}});
- It->second.push_back(Index);
- }
+ for (unsigned Index = 0; Index < Pointers.size(); ++Index)
+ PositionMap[Pointers[Index].PointerValue].push_back(Index);
// We need to keep track of what pointers we've already seen so we
// don't process them twice.
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index c939270ed39a65..3d890f05c8ca21 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -1564,8 +1564,7 @@ static void insertFoldCacheEntry(
UserIDs.pop_back();
I.first->second = S;
}
- auto R = FoldCacheUser.insert({S, {}});
- R.first->second.push_back(ID);
+ FoldCacheUser[S].push_back(ID);
}
const SCEV *
More information about the llvm-commits
mailing list