mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[CodeGen, Transforms] Use *Map::lookup (NFC)
This commit is contained in:
parent
41179ce945
commit
b3da88360d
@ -388,10 +388,7 @@ namespace llvm {
|
||||
|
||||
/// Returns an existing SUnit for this MI, or nullptr.
|
||||
inline SUnit *ScheduleDAGInstrs::getSUnit(MachineInstr *MI) const {
|
||||
DenseMap<MachineInstr*, SUnit*>::const_iterator I = MISUnitMap.find(MI);
|
||||
if (I == MISUnitMap.end())
|
||||
return nullptr;
|
||||
return I->second;
|
||||
return MISUnitMap.lookup(MI);
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -787,8 +787,7 @@ public:
|
||||
}
|
||||
|
||||
unsigned getStringTypeLoc(const DIStringType *ST) const {
|
||||
auto I = StringTypeLocMap.find(ST);
|
||||
return I != StringTypeLocMap.end() ? I->second : 0;
|
||||
return StringTypeLocMap.lookup(ST);
|
||||
}
|
||||
|
||||
void addStringTypeLoc(const DIStringType *ST, unsigned Loc) {
|
||||
|
@ -369,10 +369,7 @@ static void initSlots2Values(const Function &F,
|
||||
const Value* PerFunctionMIParsingState::getIRValue(unsigned Slot) {
|
||||
if (Slots2Values.empty())
|
||||
initSlots2Values(MF.getFunction(), Slots2Values);
|
||||
auto ValueInfo = Slots2Values.find(Slot);
|
||||
if (ValueInfo == Slots2Values.end())
|
||||
return nullptr;
|
||||
return ValueInfo->second;
|
||||
return Slots2Values.lookup(Slot);
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -3169,10 +3166,7 @@ static void initSlots2BasicBlocks(
|
||||
static const BasicBlock *getIRBlockFromSlot(
|
||||
unsigned Slot,
|
||||
const DenseMap<unsigned, const BasicBlock *> &Slots2BasicBlocks) {
|
||||
auto BlockInfo = Slots2BasicBlocks.find(Slot);
|
||||
if (BlockInfo == Slots2BasicBlocks.end())
|
||||
return nullptr;
|
||||
return BlockInfo->second;
|
||||
return Slots2BasicBlocks.lookup(Slot);
|
||||
}
|
||||
|
||||
const BasicBlock *MIParser::getIRBlock(unsigned Slot) {
|
||||
|
@ -273,12 +273,7 @@ bool PointerReplacer::collectUsers(Instruction &I) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Value *PointerReplacer::getReplacement(Value *V) {
|
||||
auto Loc = WorkMap.find(V);
|
||||
if (Loc != WorkMap.end())
|
||||
return Loc->second;
|
||||
return nullptr;
|
||||
}
|
||||
Value *PointerReplacer::getReplacement(Value *V) { return WorkMap.lookup(V); }
|
||||
|
||||
void PointerReplacer::replace(Instruction *I) {
|
||||
if (getReplacement(I))
|
||||
|
@ -210,11 +210,7 @@ static Constant *getInitializer(Constant *C) {
|
||||
Constant *Evaluator::ComputeLoadResult(Constant *P) {
|
||||
// If this memory location has been recently stored, use the stored value: it
|
||||
// is the most up-to-date.
|
||||
auto findMemLoc = [this](Constant *Ptr) {
|
||||
DenseMap<Constant *, Constant *>::const_iterator I =
|
||||
MutatedMemory.find(Ptr);
|
||||
return I != MutatedMemory.end() ? I->second : nullptr;
|
||||
};
|
||||
auto findMemLoc = [this](Constant *Ptr) { return MutatedMemory.lookup(Ptr); };
|
||||
|
||||
if (Constant *Val = findMemLoc(P))
|
||||
return Val;
|
||||
|
@ -64,8 +64,7 @@ bool SSAUpdater::HasValueForBlock(BasicBlock *BB) const {
|
||||
}
|
||||
|
||||
Value *SSAUpdater::FindValueForBlock(BasicBlock *BB) const {
|
||||
AvailableValsTy::iterator AVI = getAvailableVals(AV).find(BB);
|
||||
return (AVI != getAvailableVals(AV).end()) ? AVI->second : nullptr;
|
||||
return getAvailableVals(AV).lookup(BB);
|
||||
}
|
||||
|
||||
void SSAUpdater::AddAvailableValue(BasicBlock *BB, Value *V) {
|
||||
|
@ -1840,18 +1840,10 @@ private:
|
||||
}
|
||||
#endif
|
||||
|
||||
TreeEntry *getTreeEntry(Value *V) {
|
||||
auto I = ScalarToTreeEntry.find(V);
|
||||
if (I != ScalarToTreeEntry.end())
|
||||
return I->second;
|
||||
return nullptr;
|
||||
}
|
||||
TreeEntry *getTreeEntry(Value *V) { return ScalarToTreeEntry.lookup(V); }
|
||||
|
||||
const TreeEntry *getTreeEntry(Value *V) const {
|
||||
auto I = ScalarToTreeEntry.find(V);
|
||||
if (I != ScalarToTreeEntry.end())
|
||||
return I->second;
|
||||
return nullptr;
|
||||
return ScalarToTreeEntry.lookup(V);
|
||||
}
|
||||
|
||||
/// Maps a specific scalar to its tree entry.
|
||||
|
@ -2013,9 +2013,7 @@ public:
|
||||
/// \returns nullptr if doesn't have such group.
|
||||
InterleaveGroup<VPInstruction> *
|
||||
getInterleaveGroup(VPInstruction *Instr) const {
|
||||
if (InterleaveGroupMap.count(Instr))
|
||||
return InterleaveGroupMap.find(Instr)->second;
|
||||
return nullptr;
|
||||
return InterleaveGroupMap.lookup(Instr);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user