[Analysis, IR] Use *Map::lookup (NFC)

This commit is contained in:
Kazu Hirata 2020-12-29 19:23:24 -08:00
parent 16d20e2554
commit 329b887286
4 changed files with 6 additions and 16 deletions

View File

@ -815,8 +815,7 @@ void RegionInfoBase<Tr>::verifyAnalysis() const {
// Region pass manager support.
template <class Tr>
typename Tr::RegionT *RegionInfoBase<Tr>::getRegionFor(BlockT *BB) const {
typename BBtoRegionMap::const_iterator I = BBtoRegion.find(BB);
return I != BBtoRegion.end() ? I->second : nullptr;
return BBtoRegion.lookup(BB);
}
template <class Tr>

View File

@ -655,11 +655,7 @@ public:
/// \returns nullptr if contains no such member.
InstTy *getMember(uint32_t Index) const {
int32_t Key = SmallestKey + Index;
auto Member = Members.find(Key);
if (Member == Members.end())
return nullptr;
return Member->second;
return Members.lookup(Key);
}
/// Get the index for the given member. Unlike the key in the member
@ -777,9 +773,7 @@ public:
/// \returns nullptr if doesn't have such group.
InterleaveGroup<Instruction> *
getInterleaveGroup(const Instruction *Instr) const {
if (InterleaveGroupMap.count(Instr))
return InterleaveGroupMap.find(Instr)->second;
return nullptr;
return InterleaveGroupMap.lookup(Instr);
}
iterator_range<SmallPtrSetIterator<llvm::InterleaveGroup<Instruction> *>>

View File

@ -40,14 +40,12 @@ PassRegistry::~PassRegistry() = default;
const PassInfo *PassRegistry::getPassInfo(const void *TI) const {
sys::SmartScopedReader<true> Guard(Lock);
MapType::const_iterator I = PassInfoMap.find(TI);
return I != PassInfoMap.end() ? I->second : nullptr;
return PassInfoMap.lookup(TI);
}
const PassInfo *PassRegistry::getPassInfo(StringRef Arg) const {
sys::SmartScopedReader<true> Guard(Lock);
StringMapType::const_iterator I = PassInfoStringMap.find(Arg);
return I != PassInfoStringMap.end() ? I->second : nullptr;
return PassInfoStringMap.lookup(Arg);
}
//===----------------------------------------------------------------------===//

View File

@ -561,8 +561,7 @@ GCPtrTracker::GCPtrTracker(const Function &F, const DominatorTree &DT,
}
BasicBlockState *GCPtrTracker::getBasicBlockState(const BasicBlock *BB) {
auto it = BlockMap.find(BB);
return it != BlockMap.end() ? it->second : nullptr;
return BlockMap.lookup(BB);
}
const BasicBlockState *GCPtrTracker::getBasicBlockState(