Skip to content

[Analysis] Simplify code with DenseMap::operator[] (NFC) #111331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions llvm/lib/Analysis/BasicAliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Analysis/LoopAccessAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/ScalarEvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
Loading