[llvm] 3c03a15 - [llvm] Use DenseMap::lookup (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 18:44:25 PDT 2023
Author: Kazu Hirata
Date: 2023-08-10T18:44:16-07:00
New Revision: 3c03a1510413e8f9171efdb86f554d33e3fa182f
URL: https://github.com/llvm/llvm-project/commit/3c03a1510413e8f9171efdb86f554d33e3fa182f
DIFF: https://github.com/llvm/llvm-project/commit/3c03a1510413e8f9171efdb86f554d33e3fa182f.diff
LOG: [llvm] Use DenseMap::lookup (NFC)
Added:
Modified:
llvm/include/llvm/ADT/GenericCycleImpl.h
llvm/lib/TextAPI/SymbolSet.cpp
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/GenericCycleImpl.h b/llvm/include/llvm/ADT/GenericCycleImpl.h
index 11dda696cf25f8..eae5407dfa42e0 100644
--- a/llvm/include/llvm/ADT/GenericCycleImpl.h
+++ b/llvm/include/llvm/ADT/GenericCycleImpl.h
@@ -370,10 +370,7 @@ void GenericCycleInfo<ContextT>::compute(FunctionT &F) {
template <typename ContextT>
auto GenericCycleInfo<ContextT>::getCycle(const BlockT *Block) const
-> CycleT * {
- auto MapIt = BlockMap.find(Block);
- if (MapIt != BlockMap.end())
- return MapIt->second;
- return nullptr;
+ return BlockMap.lookup(Block);
}
/// \brief get the depth for the cycle which containing a given block.
diff --git a/llvm/lib/TextAPI/SymbolSet.cpp b/llvm/lib/TextAPI/SymbolSet.cpp
index 157e1374972938..5b9882dadcdf40 100644
--- a/llvm/lib/TextAPI/SymbolSet.cpp
+++ b/llvm/lib/TextAPI/SymbolSet.cpp
@@ -29,8 +29,5 @@ Symbol *SymbolSet::addGlobal(SymbolKind Kind, StringRef Name, SymbolFlags Flags,
}
const Symbol *SymbolSet::findSymbol(SymbolKind Kind, StringRef Name) const {
- auto It = Symbols.find({Kind, Name});
- if (It != Symbols.end())
- return It->second;
- return nullptr;
+ return Symbols.lookup({Kind, Name});
}
diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index 1582e871de89a1..42ae6f5cd693b7 100644
--- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -179,9 +179,7 @@ Cost InstCostVisitor::estimateBasicBlocks(
static Constant *findConstantFor(Value *V, ConstMap &KnownConstants) {
if (auto *C = dyn_cast<Constant>(V))
return C;
- if (auto It = KnownConstants.find(V); It != KnownConstants.end())
- return It->second;
- return nullptr;
+ return KnownConstants.lookup(V);
}
Bonus InstCostVisitor::getBonusFromPendingPHIs() {
More information about the llvm-commits
mailing list