Skip to content

Commit 3c03a15

Browse files
[llvm] Use DenseMap::lookup (NFC)
1 parent b46d035 commit 3c03a15

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

llvm/include/llvm/ADT/GenericCycleImpl.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,7 @@ void GenericCycleInfo<ContextT>::compute(FunctionT &F) {
370370
template <typename ContextT>
371371
auto GenericCycleInfo<ContextT>::getCycle(const BlockT *Block) const
372372
-> CycleT * {
373-
auto MapIt = BlockMap.find(Block);
374-
if (MapIt != BlockMap.end())
375-
return MapIt->second;
376-
return nullptr;
373+
return BlockMap.lookup(Block);
377374
}
378375

379376
/// \brief get the depth for the cycle which containing a given block.

llvm/lib/TextAPI/SymbolSet.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,5 @@ Symbol *SymbolSet::addGlobal(SymbolKind Kind, StringRef Name, SymbolFlags Flags,
2929
}
3030

3131
const Symbol *SymbolSet::findSymbol(SymbolKind Kind, StringRef Name) const {
32-
auto It = Symbols.find({Kind, Name});
33-
if (It != Symbols.end())
34-
return It->second;
35-
return nullptr;
32+
return Symbols.lookup({Kind, Name});
3633
}

llvm/lib/Transforms/IPO/FunctionSpecialization.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ Cost InstCostVisitor::estimateBasicBlocks(
179179
static Constant *findConstantFor(Value *V, ConstMap &KnownConstants) {
180180
if (auto *C = dyn_cast<Constant>(V))
181181
return C;
182-
if (auto It = KnownConstants.find(V); It != KnownConstants.end())
183-
return It->second;
184-
return nullptr;
182+
return KnownConstants.lookup(V);
185183
}
186184

187185
Bonus InstCostVisitor::getBonusFromPendingPHIs() {

0 commit comments

Comments
 (0)