llvm.org GIT mirror llvm / 7d3ea70
Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344774 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 1 year, 1 day ago
10 changed file(s) with 40 addition(s) and 52 deletion(s). Raw diff Collapse all Expand all
253253
254254 // Don't emit locations that cannot be expressed without DW_OP_stack_value.
255255 if (DwarfVersion < 4)
256 if (std::any_of(ExprCursor.begin(), ExprCursor.end(),
257 [](DIExpression::ExprOperand Op) -> bool {
258 return Op.getOp() == dwarf::DW_OP_stack_value;
259 })) {
256 if (any_of(ExprCursor, [](DIExpression::ExprOperand Op) -> bool {
257 return Op.getOp() == dwarf::DW_OP_stack_value;
258 })) {
260259 DwarfRegs.clear();
261260 LocationKind = Unknown;
262261 return false;
50835083 unsigned FrameID = MachineOutlinerDefault;
50845084 unsigned NumBytesToCreateFrame = 4;
50855085
5086 bool HasBTI =
5087 std::any_of(RepeatedSequenceLocs.begin(), RepeatedSequenceLocs.end(),
5088 [](outliner::Candidate &C) {
5089 return C.getMF()->getFunction().hasFnAttribute(
5090 "branch-target-enforcement");
5091 });
5086 bool HasBTI = any_of(RepeatedSequenceLocs, [](outliner::Candidate &C) {
5087 return C.getMF()->getFunction().hasFnAttribute("branch-target-enforcement");
5088 });
50925089
50935090 // If the last instruction in any candidate is a terminator, then we should
50945091 // tail call all of the candidates.
51235120 // LR is live, so we need to save it. Decide whether it should be saved to
51245121 // the stack, or if it can be saved to a register.
51255122 else {
5126 if (std::all_of(RepeatedSequenceLocs.begin(), RepeatedSequenceLocs.end(),
5127 [this](outliner::Candidate &C) {
5128 return findRegisterToSaveLRTo(C);
5129 })) {
5123 if (all_of(RepeatedSequenceLocs, [this](outliner::Candidate &C) {
5124 return findRegisterToSaveLRTo(C);
5125 })) {
51305126 // Every candidate has an available callee-saved register for the save.
51315127 // We can save LR to a register.
51325128 FrameID = MachineOutlinerRegSave;
51945190 unsigned Flags = 0x0;
51955191 // Check if there's a call inside this MachineBasicBlock. If there is, then
51965192 // set a flag.
5197 if (std::any_of(MBB.begin(), MBB.end(),
5198 [](MachineInstr &MI) { return MI.isCall(); }))
5193 if (any_of(MBB, [](MachineInstr &MI) { return MI.isCall(); }))
51995194 Flags |= MachineOutlinerMBBFlags::HasCalls;
52005195
52015196 // Check if LR is available through all of the MBB. If it's not, then set
23592359 auto DominatedByBB = [this,BB] (BasicBlock *EB) -> bool {
23602360 return DT->dominates(BB, EB);
23612361 };
2362 if (!std::all_of(ExitBlocks.begin(), ExitBlocks.end(), DominatedByBB))
2362 if (!all_of(ExitBlocks, DominatedByBB))
23632363 return false;
23642364
23652365 bool MadeChange = false;
210210 }
211211
212212 // If it requires a conversion for every PHI operand, do not do it.
213 if (std::all_of(AvailablePtrVals.begin(), AvailablePtrVals.end(),
214 [&](Value *V) {
215 return (V->getType() != IntToPtr->getType()) ||
216 isa(V);
217 }))
213 if (all_of(AvailablePtrVals, [&](Value *V) {
214 return (V->getType() != IntToPtr->getType()) || isa(V);
215 }))
218216 return nullptr;
219217
220218 // If any of the operand that requires casting is a terminator
221219 // instruction, do not do it.
222 if (std::any_of(AvailablePtrVals.begin(), AvailablePtrVals.end(),
223 [&](Value *V) {
224 if (V->getType() == IntToPtr->getType())
225 return false;
226
227 auto *Inst = dyn_cast(V);
228 return Inst && Inst->isTerminator();
229 }))
220 if (any_of(AvailablePtrVals, [&](Value *V) {
221 if (V->getType() == IntToPtr->getType())
222 return false;
223
224 auto *Inst = dyn_cast(V);
225 return Inst && Inst->isTerminator();
226 }))
230227 return nullptr;
231228
232229 PHINode *NewPtrPHI = PHINode::Create(
460460 PredsCS.push_back({Pred, Conditions});
461461 }
462462
463 if (std::all_of(PredsCS.begin(), PredsCS.end(),
464 [](const std::pair &P) {
465 return P.second.empty();
466 }))
463 if (all_of(PredsCS, [](const std::pair &P) {
464 return P.second.empty();
465 }))
467466 return false;
468467
469468 splitCallSite(CS, PredsCS, DT);
623623
624624 if (Verify) {
625625 // If we encountered errors during verify, exit with a non-zero exit status.
626 if (!std::all_of(Objects.begin(), Objects.end(), [&](std::string Object) {
626 if (!all_of(Objects, [&](std::string Object) {
627627 return handleFile(Object, verifyObjectFile, OS);
628628 }))
629629 exit(1);
656656
657657 // Print any scheduling class that has at least one cluster that does not
658658 // match the checked-in data.
659 if (std::all_of(SchedClassClusters.begin(), SchedClassClusters.end(),
660 [this, &RSCAndPoints](const SchedClassCluster &C) {
661 return C.measurementsMatch(*SubtargetInfo_,
662 RSCAndPoints.RSC, Clustering_);
663 }))
659 if (llvm::all_of(SchedClassClusters,
660 [this, &RSCAndPoints](const SchedClassCluster &C) {
661 return C.measurementsMatch(
662 *SubtargetInfo_, RSCAndPoints.RSC, Clustering_);
663 }))
664664 continue; // Nothing weird.
665665
666666 OS << "

Sched Class

173173 }
174174
175175 bool Instruction::hasMemoryOperands() const {
176 return std::any_of(Operands.begin(), Operands.end(), [](const Operand &Op) {
176 return any_of(Operands, [](const Operand &Op) {
177177 return Op.isReg() && Op.isExplicit() && Op.isMemory();
178178 });
179179 }
217217 }
218218
219219 bool ResourceManager::canBeIssued(const InstrDesc &Desc) const {
220 return std::all_of(Desc.Resources.begin(), Desc.Resources.end(),
221 [&](const std::pair &E) {
222 unsigned NumUnits =
223 E.second.isReserved() ? 0U : E.second.NumUnits;
224 unsigned Index = getResourceStateIndex(E.first);
225 return Resources[Index]->isReady(NumUnits);
226 });
220 return all_of(
221 Desc.Resources, [&](const std::pair &E) {
222 unsigned NumUnits = E.second.isReserved() ? 0U : E.second.NumUnits;
223 unsigned Index = getResourceStateIndex(E.first);
224 return Resources[Index]->isReady(NumUnits);
225 });
227226 }
228227
229228 // Returns true if all resources are in-order, and there is at least one
24142414 static void emitRegisterMatchErrorFunc(AsmMatcherInfo &Info, raw_ostream &OS) {
24152415 OS << "static unsigned getDiagKindFromRegisterClass(MatchClassKind "
24162416 "RegisterClass) {\n";
2417 if (std::none_of(Info.Classes.begin(), Info.Classes.end(),
2418 [](const ClassInfo &CI) {
2419 return CI.isRegisterClass() && !CI.DiagnosticType.empty();
2420 })) {
2417 if (none_of(Info.Classes, [](const ClassInfo &CI) {
2418 return CI.isRegisterClass() && !CI.DiagnosticType.empty();
2419 })) {
24212420 OS << " return MCTargetAsmParser::Match_InvalidOperand;\n";
24222421 } else {
24232422 OS << " switch (RegisterClass) {\n";