1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[CodeGen, DebugInfo] Use llvm::find_if (NFC)

This commit is contained in:
Kazu Hirata 2021-01-10 09:24:53 -08:00
parent f97e87b3dc
commit a6e95fbf6b
7 changed files with 19 additions and 21 deletions

View File

@ -633,8 +633,8 @@ void CodeGenPrepare::removeAllAssertingVHReferences(Value *V) {
return; return;
auto &GEPVector = VecI->second; auto &GEPVector = VecI->second;
const auto &I = std::find_if(GEPVector.begin(), GEPVector.end(), const auto &I =
[=](auto &Elt) { return Elt.first == GEP; }); llvm::find_if(GEPVector, [=](auto &Elt) { return Elt.first == GEP; });
if (I == GEPVector.end()) if (I == GEPVector.end())
return; return;

View File

@ -1104,10 +1104,8 @@ InterleavedLoadCombineImpl::findFirstLoad(const std::set<LoadInst *> &LIs) {
// All LIs are within the same BB. Select the first for a reference. // All LIs are within the same BB. Select the first for a reference.
BasicBlock *BB = (*LIs.begin())->getParent(); BasicBlock *BB = (*LIs.begin())->getParent();
BasicBlock::iterator FLI = BasicBlock::iterator FLI = llvm::find_if(
std::find_if(BB->begin(), BB->end(), [&LIs](Instruction &I) -> bool { *BB, [&LIs](Instruction &I) -> bool { return is_contained(LIs, &I); });
return is_contained(LIs, &I);
});
assert(FLI != BB->end()); assert(FLI != BB->end());
return cast<LoadInst>(FLI); return cast<LoadInst>(FLI);

View File

@ -275,9 +275,9 @@ static bool rescheduleCanonically(unsigned &PseudoIdempotentInstCount,
// Sort the defs for users of multiple defs lexographically. // Sort the defs for users of multiple defs lexographically.
for (const auto &E : MultiUserLookup) { for (const auto &E : MultiUserLookup) {
auto UseI = auto UseI = llvm::find_if(MBB->instrs(), [&](MachineInstr &MI) -> bool {
std::find_if(MBB->instr_begin(), MBB->instr_end(), return &MI == E.second;
[&](MachineInstr &MI) -> bool { return &MI == E.second; }); });
if (UseI == MBB->instr_end()) if (UseI == MBB->instr_end())
continue; continue;

View File

@ -634,9 +634,8 @@ static Register scavengeVReg(MachineRegisterInfo &MRI, RegScavenger &RS,
// we get a single contiguous lifetime. // we get a single contiguous lifetime.
// //
// Definitions in MRI.def_begin() are unordered, search for the first. // Definitions in MRI.def_begin() are unordered, search for the first.
MachineRegisterInfo::def_iterator FirstDef = MachineRegisterInfo::def_iterator FirstDef = llvm::find_if(
std::find_if(MRI.def_begin(VReg), MRI.def_end(), MRI.def_operands(VReg), [VReg, &TRI](const MachineOperand &MO) {
[VReg, &TRI](const MachineOperand &MO) {
return !MO.getParent()->readsRegister(VReg, &TRI); return !MO.getParent()->readsRegister(VReg, &TRI);
}); });
assert(FirstDef != MRI.def_end() && assert(FirstDef != MRI.def_end() &&

View File

@ -202,8 +202,8 @@ void SwiftErrorValueTracking::propagateVRegs() {
// downward defs. // downward defs.
bool needPHI = bool needPHI =
VRegs.size() >= 1 && VRegs.size() >= 1 &&
std::find_if( llvm::find_if(
VRegs.begin(), VRegs.end(), VRegs,
[&](const std::pair<const MachineBasicBlock *, Register> &V) [&](const std::pair<const MachineBasicBlock *, Register> &V)
-> bool { return V.second != VRegs[0].second; }) != -> bool { return V.second != VRegs[0].second; }) !=
VRegs.end(); VRegs.end();

View File

@ -71,8 +71,8 @@ void DWARFGdbIndex::dumpSymbolTable(raw_ostream &OS) const {
StringRef Name = ConstantPoolStrings.substr( StringRef Name = ConstantPoolStrings.substr(
ConstantPoolOffset - StringPoolOffset + E.NameOffset); ConstantPoolOffset - StringPoolOffset + E.NameOffset);
auto CuVector = std::find_if( auto CuVector = llvm::find_if(
ConstantPoolVectors.begin(), ConstantPoolVectors.end(), ConstantPoolVectors,
[&](const std::pair<uint32_t, SmallVector<uint32_t, 0>> &V) { [&](const std::pair<uint32_t, SmallVector<uint32_t, 0>> &V) {
return V.first == E.VecOffset; return V.first == E.VecOffset;
}); });

View File

@ -109,9 +109,10 @@ SymIndexId SymbolCache::createSimpleType(TypeIndex Index,
return createSymbol<NativeTypePointer>(Index); return createSymbol<NativeTypePointer>(Index);
const auto Kind = Index.getSimpleKind(); const auto Kind = Index.getSimpleKind();
const auto It = std::find_if( const auto It =
std::begin(BuiltinTypes), std::end(BuiltinTypes), llvm::find_if(BuiltinTypes, [Kind](const BuiltinTypeEntry &Builtin) {
[Kind](const BuiltinTypeEntry &Builtin) { return Builtin.Kind == Kind; }); return Builtin.Kind == Kind;
});
if (It == std::end(BuiltinTypes)) if (It == std::end(BuiltinTypes))
return 0; return 0;
return createSymbol<NativeTypeBuiltin>(Mods, It->Type, It->Size); return createSymbol<NativeTypeBuiltin>(Mods, It->Type, It->Size);