llvm.org GIT mirror llvm / 975248e
Use the range variant of find instead of unpacking begin/end If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278433 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 4 years ago
78 changed file(s) with 143 addition(s) and 206 deletion(s). Raw diff Collapse all Expand all
7171 }
7272
7373 void removeModule(ModuleHandleT H) {
74 ModuleHandles.erase(
75 std::find(ModuleHandles.begin(), ModuleHandles.end(), H));
74 ModuleHandles.erase(find(ModuleHandles, H));
7675 CompileLayer.removeModuleSet(H);
7776 }
7877
4545 ///
4646 void erase_one(const T &t) {
4747 // Linear-search to find the element.
48 typename Sequence::size_type i =
49 std::find(this->c.begin(), this->c.end(), t) - this->c.begin();
48 typename Sequence::size_type i = find(this->c, t) - this->c.begin();
5049
5150 // Logarithmic-time heap bubble-up.
5251 while (i != 0) {
2020 #define LLVM_ADT_SETVECTOR_H
2121
2222 #include "llvm/ADT/DenseSet.h"
23 #include "llvm/ADT/STLExtras.h"
2324 #include "llvm/ADT/SmallSet.h"
2425 #include
2526 #include
142143 /// \brief Remove an item from the set vector.
143144 bool remove(const value_type& X) {
144145 if (set_.erase(X)) {
145 typename vector_type::iterator I =
146 std::find(vector_.begin(), vector_.end(), X);
146 typename vector_type::iterator I = find(vector_, X);
147147 assert(I != vector_.end() && "Corrupted SetVector instances!");
148148 vector_.erase(I);
149149 return true;
328328 /// Blocks as appropriate. This does not update the mapping in the LoopInfo
329329 /// class.
330330 void removeBlockFromLoop(BlockT *BB) {
331 auto I = std::find(Blocks.begin(), Blocks.end(), BB);
331 auto I = find(Blocks, BB);
332332 assert(I != Blocks.end() && "N is not in this list!");
333333 Blocks.erase(I);
334334
593593 /// loop.
594594 void changeTopLevelLoop(LoopT *OldLoop,
595595 LoopT *NewLoop) {
596 auto I = std::find(TopLevelLoops.begin(), TopLevelLoops.end(), OldLoop);
596 auto I = find(TopLevelLoops, OldLoop);
597597 assert(I != TopLevelLoops.end() && "Old loop not at top level!");
598598 *I = NewLoop;
599599 assert(!NewLoop->ParentLoop && !OldLoop->ParentLoop &&
210210 replaceChildLoopWith(LoopT *OldChild, LoopT *NewChild) {
211211 assert(OldChild->ParentLoop == this && "This loop is already broken!");
212212 assert(!NewChild->ParentLoop && "NewChild already has a parent!");
213 typename std::vector::iterator I =
214 std::find(SubLoops.begin(), SubLoops.end(), OldChild);
213 typename std::vector::iterator I = find(SubLoops, OldChild);
215214 assert(I != SubLoops.end() && "OldChild not in loop!");
216215 *I = NewChild;
217216 OldChild->ParentLoop = nullptr;
9191 /// machine instruction. Returns true if there was a kill
9292 /// corresponding to this instruction, false otherwise.
9393 bool removeKill(MachineInstr &MI) {
94 std::vector::iterator I =
95 std::find(Kills.begin(), Kills.end(), &MI);
94 std::vector::iterator I = find(Kills, &MI);
9695 if (I == Kills.end())
9796 return false;
9897 Kills.erase(I);
517517
518518 ArrayRef elements() { return Queue; }
519519
520 iterator find(SUnit *SU) {
521 return std::find(Queue.begin(), Queue.end(), SU);
522 }
520 iterator find(SUnit *SU) { return llvm::find(Queue, SU); }
523521
524522 void push(SUnit *SU) {
525523 Queue.push_back(SU);
261261
262262 private:
263263 NodeId findNextInUse(NodeId NId) const {
264 while (NId < EndNId &&
265 std::find(FreeNodeIds.begin(), FreeNodeIds.end(), NId) !=
266 FreeNodeIds.end()) {
264 while (NId < EndNId && is_contained(FreeNodeIds, NId)) {
267265 ++NId;
268266 }
269267 return NId;
287285
288286 private:
289287 EdgeId findNextInUse(EdgeId EId) const {
290 while (EId < EndEId &&
291 std::find(FreeEdgeIds.begin(), FreeEdgeIds.end(), EId) !=
292 FreeEdgeIds.end()) {
288 while (EId < EndEId && is_contained(FreeEdgeIds, EId)) {
293289 ++EId;
294290 }
295291 return EId;
14771477 bool hasOperandBundlesOtherThan(ArrayRef IDs) const {
14781478 for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
14791479 uint32_t ID = getOperandBundleAt(i).getTagID();
1480 if (std::find(IDs.begin(), IDs.end(), ID) == IDs.end())
1480 if (!is_contained(IDs, ID))
14811481 return true;
14821482 }
14831483 return false;
99 #ifndef LLVM_MC_MCASSEMBLER_H
1010 #define LLVM_MC_MCASSEMBLER_H
1111
12 #include "llvm/ADT/STLExtras.h"
1213 #include "llvm/ADT/SmallPtrSet.h"
1314 #include "llvm/ADT/ilist.h"
1415 #include "llvm/ADT/ilist_node.h"
401402 ArrayRef getFileNames() { return FileNames; }
402403
403404 void addFileName(StringRef FileName) {
404 if (std::find(FileNames.begin(), FileNames.end(), FileName) ==
405 FileNames.end())
405 if (!is_contained(FileNames, FileName))
406406 FileNames.push_back(FileName);
407407 }
408408
125125 assert(IDom && "No immediate dominator?");
126126 if (IDom != NewIDom) {
127127 typename std::vector *>::iterator I =
128 std::find(IDom->Children.begin(), IDom->Children.end(), this);
128 find(IDom->Children, this);
129129 assert(I != IDom->Children.end() &&
130130 "Not in immediate dominator children set!");
131131 // I am no longer your child...
587587 DomTreeNodeBase *IDom = Node->getIDom();
588588 if (IDom) {
589589 typename std::vector *>::iterator I =
590 std::find(IDom->Children.begin(), IDom->Children.end(), Node);
590 find(IDom->Children, Node);
591591 assert(I != IDom->Children.end() &&
592592 "Not in immediate dominator children set!");
593593 // I am no longer your child...
8181 }
8282 // Note that this is a member of the given color.
8383 ColorVector &Colors = BlockColors[Visiting];
84 if (std::find(Colors.begin(), Colors.end(), Color) == Colors.end())
84 if (!is_contained(Colors, Color))
8585 Colors.push_back(Color);
8686 else
8787 continue;
520520 // Can't say anything about it. However, if it is inside our SCC,
521521 // then nothing needs to be done.
522522 CallGraphNode *CalleeNode = CG[Callee];
523 if (std::find(SCC.begin(), SCC.end(), CalleeNode) == SCC.end())
523 if (!is_contained(SCC, CalleeNode))
524524 KnowNothing = true;
525525 }
526526 } else {
906906 RefSCC &TargetRC = *G->lookupRefSCC(TargetN);
907907 assert(&TargetRC != this && "The target must not be a member of this RefSCC");
908908
909 assert(std::find(G->LeafRefSCCs.begin(), G->LeafRefSCCs.end(), this) ==
910 G->LeafRefSCCs.end() &&
909 assert(!is_contained(G->LeafRefSCCs, this) &&
911910 "Cannot have a leaf RefSCC source.");
912911
913912 // First remove it from the node.
6161
6262 // If it's an instruction, it is either in Tmp or its operands recursively
6363 // are.
64 SmallVectorImpl::iterator Entry =
65 std::find(InstInputs.begin(), InstInputs.end(), I);
64 SmallVectorImpl::iterator Entry = find(InstInputs, I);
6665 if (Entry != InstInputs.end()) {
6766 InstInputs.erase(Entry);
6867 return true;
125124 if (!I) return;
126125
127126 // If the instruction is in the InstInputs list, remove it.
128 SmallVectorImpl::iterator Entry =
129 std::find(InstInputs.begin(), InstInputs.end(), I);
127 SmallVectorImpl::iterator Entry = find(InstInputs, I);
130128 if (Entry != InstInputs.end()) {
131129 InstInputs.erase(Entry);
132130 return;
149147 if (!Inst) return V;
150148
151149 // Determine whether 'Inst' is an input to our PHI translatable expression.
152 bool isInput =
153 std::find(InstInputs.begin(), InstInputs.end(), Inst) != InstInputs.end();
150 bool isInput = is_contained(InstInputs, Inst);
154151
155152 // Handle inputs instructions if needed.
156153 if (isInput) {
164161 // translated, we need to incorporate the value into the expression or fail.
165162
166163 // In either case, the instruction itself isn't an input any longer.
167 InstInputs.erase(std::find(InstInputs.begin(), InstInputs.end(), Inst));
164 InstInputs.erase(find(InstInputs, Inst));
168165
169166 // If this is a PHI, go ahead and translate it.
170167 if (PHINode *PN = dyn_cast(Inst))
271268 isNSW = isNUW = false;
272269
273270 // If the old 'LHS' was an input, add the new 'LHS' as an input.
274 if (std::find(InstInputs.begin(), InstInputs.end(), BOp) !=
275 InstInputs.end()) {
271 if (is_contained(InstInputs, BOp)) {
276272 RemoveInstInputs(BOp, InstInputs);
277273 AddAsInput(LHS);
278274 }
4747 });
4848 #ifndef NDEBUG
4949 for (unsigned I = 0, E = Hints.size(); I != E; ++I)
50 assert(std::find(Order.begin(), Order.end(), Hints[I]) != Order.end() &&
50 assert(is_contained(Order, Hints[I]) &&
5151 "Target hint is outside allocation order.");
5252 #endif
5353 }
1717 #define LLVM_LIB_CODEGEN_ALLOCATIONORDER_H
1818
1919 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/STLExtras.h"
2021 #include "llvm/MC/MCRegisterInfo.h"
2122
2223 namespace llvm {
7879 bool isHint() const { return Pos <= 0; }
7980
8081 /// Return true if PhysReg is a preferred register.
81 bool isHint(unsigned PhysReg) const {
82 return std::find(Hints.begin(), Hints.end(), PhysReg) != Hints.end();
83 }
82 bool isHint(unsigned PhysReg) const { return is_contained(Hints, PhysReg); }
8483 };
8584
8685 } // end namespace llvm
8282 const auto &I = RegVars.find(RegNo);
8383 assert(RegNo != 0U && I != RegVars.end());
8484 auto &VarSet = I->second;
85 const auto &VarPos = std::find(VarSet.begin(), VarSet.end(), Var);
85 const auto &VarPos = find(VarSet, Var);
8686 assert(VarPos != VarSet.end());
8787 VarSet.erase(VarPos);
8888 // Don't keep empty sets in a map to keep it as small as possible.
9595 InlinedVariable Var) {
9696 assert(RegNo != 0U);
9797 auto &VarSet = RegVars[RegNo];
98 assert(std::find(VarSet.begin(), VarSet.end(), Var) == VarSet.end());
98 assert(!is_contained(VarSet, Var));
9999 VarSet.push_back(Var);
100100 }
101101
4949 std::string SymName;
5050 SymName += "caml";
5151 size_t Letter = SymName.size();
52 SymName.append(MId.begin(), std::find(MId.begin(), MId.end(), '.'));
52 SymName.append(MId.begin(), find(MId, '.'));
5353 SymName += "__";
5454 SymName += Id;
5555
36643664 TPT.rollback(LastKnownGood);
36653665
36663666 // If the match didn't cover I, then it won't be shared by it.
3667 if (std::find(MatchedAddrModeInsts.begin(), MatchedAddrModeInsts.end(),
3668 I) == MatchedAddrModeInsts.end())
3667 if (!is_contained(MatchedAddrModeInsts, I))
36693668 return false;
36703669
36713670 MatchedAddrModeInsts.clear();
132132
133133 void LatencyPriorityQueue::remove(SUnit *SU) {
134134 assert(!Queue.empty() && "Queue is empty!");
135 std::vector::iterator I = std::find(Queue.begin(), Queue.end(), SU);
135 std::vector::iterator I = find(Queue, SU);
136136 if (I != std::prev(Queue.end()))
137137 std::swap(*I, Queue.back());
138138 Queue.pop_back();
1313 //===----------------------------------------------------------------------===//
1414
1515 #include "llvm/CodeGen/LiveIntervalUnion.h"
16 #include "llvm/ADT/STLExtras.h"
1617 #include "llvm/ADT/SparseBitVector.h"
1718 #include "llvm/Support/Debug.h"
1819 #include "llvm/Support/raw_ostream.h"
101102 // Scan the vector of interfering virtual registers in this union. Assume it's
102103 // quite small.
103104 bool LiveIntervalUnion::Query::isSeenInterference(LiveInterval *VirtReg) const {
104 SmallVectorImpl::const_iterator I =
105 std::find(InterferingVRegs.begin(), InterferingVRegs.end(), VirtReg);
106 return I != InterferingVRegs.end();
105 return is_contained(InterferingVRegs, VirtReg);
107106 }
108107
109108 // Collect virtual registers in this union that interfere with this
544544
545545 void MachineBasicBlock::removeSuccessor(MachineBasicBlock *Succ,
546546 bool NormalizeSuccProbs) {
547 succ_iterator I = std::find(Successors.begin(), Successors.end(), Succ);
547 succ_iterator I = find(Successors, Succ);
548548 removeSuccessor(I, NormalizeSuccProbs);
549549 }
550550
610610 }
611611
612612 void MachineBasicBlock::removePredecessor(MachineBasicBlock *Pred) {
613 pred_iterator I = std::find(Predecessors.begin(), Predecessors.end(), Pred);
613 pred_iterator I = find(Predecessors, Pred);
614614 assert(I != Predecessors.end() && "Pred is not a predecessor of this block!");
615615 Predecessors.erase(I);
616616 }
774774 continue;
775775
776776 unsigned Reg = OI->getReg();
777 if (std::find(UsedRegs.begin(), UsedRegs.end(), Reg) == UsedRegs.end())
777 if (!is_contained(UsedRegs, Reg))
778778 UsedRegs.push_back(Reg);
779779 }
780780 }
801801
802802 for (SmallVectorImpl::iterator I = Terminators.begin(),
803803 E = Terminators.end(); I != E; ++I) {
804 if (std::find(NewTerminators.begin(), NewTerminators.end(), *I) ==
805 NewTerminators.end())
806 Indexes->removeMachineInstrFromMaps(**I);
804 if (!is_contained(NewTerminators, *I))
805 Indexes->removeMachineInstrFromMaps(**I);
807806 }
808807 }
809808
11651165 }
11661166 }
11671167
1168 BlockChain::iterator ExitIt =
1169 std::find(LoopChain.begin(), LoopChain.end(), ExitingBB);
1168 BlockChain::iterator ExitIt = find(LoopChain, ExitingBB);
11701169 if (ExitIt == LoopChain.end())
11711170 return;
11721171
11891188 void MachineBlockPlacement::rotateLoopWithProfile(
11901189 BlockChain &LoopChain, MachineLoop &L, const BlockFilterSet &LoopBlockSet) {
11911190 auto HeaderBB = L.getHeader();
1192 auto HeaderIter = std::find(LoopChain.begin(), LoopChain.end(), HeaderBB);
1191 auto HeaderIter = find(LoopChain, HeaderBB);
11931192 auto RotationPos = LoopChain.end();
11941193
11951194 BlockFrequency SmallestRotationCost = BlockFrequency::getMaxFrequency();
244244 // Remember source that's copied to Def. Once it's clobbered, then
245245 // it's no longer available for copy propagation.
246246 RegList &DestList = SrcMap[Src];
247 if (std::find(DestList.begin(), DestList.end(), Def) == DestList.end())
247 if (!is_contained(DestList, Def))
248248 DestList.push_back(Def);
249249
250250 continue;
9191 SmallVector ExitBlocks;
9292
9393 bool isExitBlock(const MachineBasicBlock *MBB) const {
94 return std::find(ExitBlocks.begin(), ExitBlocks.end(), MBB) !=
95 ExitBlocks.end();
94 return is_contained(ExitBlocks, MBB);
9695 }
9796
9897 // Track 'estimated' register pressure.
12371237 if (LiveVars && TargetRegisterInfo::isVirtualRegister(Reg) &&
12381238 MO->isKill()) {
12391239 LiveVariables::VarInfo &VI = LiveVars->getVarInfo(Reg);
1240 if (std::find(VI.Kills.begin(), VI.Kills.end(), MI) == VI.Kills.end())
1240 if (!is_contained(VI.Kills, MI))
12411241 report("Kill missing from LiveVariables", MO, MONum);
12421242 }
12431243
15701570 break;
15711571
15721572 case ISD::TokenFactor:
1573 if (Op.hasOneUse() &&
1574 std::find(TFs.begin(), TFs.end(), Op.getNode()) == TFs.end()) {
1573 if (Op.hasOneUse() && !is_contained(TFs, Op.getNode())) {
15751574 // Queue up for processing.
15761575 TFs.push_back(Op.getNode());
15771576 // Clean up in case the token factor is removed.
598598 unsigned FunctionLoweringInfo::findSwiftErrorVReg(const MachineBasicBlock *MBB,
599599 const Value* Val) const {
600600 // Find the index in SwiftErrorVals.
601 SwiftErrorValues::const_iterator I =
602 std::find(SwiftErrorVals.begin(), SwiftErrorVals.end(), Val);
601 SwiftErrorValues::const_iterator I = find(SwiftErrorVals, Val);
603602 assert(I != SwiftErrorVals.end() && "Can't find value in SwiftErrorVals");
604603 return SwiftErrorMap.lookup(MBB)[I - SwiftErrorVals.begin()];
605604 }
607606 void FunctionLoweringInfo::setSwiftErrorVReg(const MachineBasicBlock *MBB,
608607 const Value* Val, unsigned VReg) {
609608 // Find the index in SwiftErrorVals.
610 SwiftErrorValues::iterator I =
611 std::find(SwiftErrorVals.begin(), SwiftErrorVals.end(), Val);
609 SwiftErrorValues::iterator I = find(SwiftErrorVals, Val);
612610 assert(I != SwiftErrorVals.end() && "Can't find value in SwiftErrorVals");
613611 SwiftErrorMap[MBB][I - SwiftErrorVals.begin()] = VReg;
614612 }
630630
631631 void ResourcePriorityQueue::remove(SUnit *SU) {
632632 assert(!Queue.empty() && "Queue is empty!");
633 std::vector::iterator I = std::find(Queue.begin(), Queue.end(), SU);
633 std::vector::iterator I = find(Queue, SU);
634634 if (I != std::prev(Queue.end()))
635635 std::swap(*I, Queue.back());
636636
13381338 LRegsMapT::iterator LRegsPos = LRegsMap.find(SU);
13391339 if (Reg) {
13401340 SmallVectorImpl &LRegs = LRegsPos->second;
1341 if (std::find(LRegs.begin(), LRegs.end(), Reg) == LRegs.end())
1341 if (!is_contained(LRegs, Reg))
13421342 continue;
13431343 }
13441344 SU->isPending = false;
17031703 void remove(SUnit *SU) override {
17041704 assert(!Queue.empty() && "Queue is empty!");
17051705 assert(SU->NodeQueueId != 0 && "Not in queue!");
1706 std::vector::iterator I = std::find(Queue.begin(), Queue.end(),
1707 SU);
1706 std::vector::iterator I = find(Queue, SU);
17081707 if (I != std::prev(Queue.end()))
17091708 std::swap(*I, Queue.back());
17101709 Queue.pop_back();
33873387 SelectionDAG::DAGNodeDeletedListener NDL(*CurDAG, [&](SDNode *N,
33883388 SDNode *E) {
33893389 auto &Chain = ChainNodesMatched;
3390 assert((!E || llvm::find(Chain, N) == Chain.end()) &&
3390 assert((!E || !is_contained(Chain, N)) &&
33913391 "Chain node replaced during MorphNode");
33923392 Chain.erase(std::remove(Chain.begin(), Chain.end(), N), Chain.end());
33933393 });
899899 PE = Preds.end();
900900 PI != PE; ++PI) {
901901 MachineBasicBlock *PredBB = *PI;
902 if (std::find(TDBBs.begin(), TDBBs.end(), PredBB) != TDBBs.end())
902 if (is_contained(TDBBs, PredBB))
903903 continue;
904904
905905 // EH edges
466466
467467 for (unsigned i = StartIdx; i < MI.getNumOperands(); ++i) {
468468 MachineOperand &MO = MI.getOperand(i);
469 if (std::find(Ops.begin(), Ops.end(), i) != Ops.end()) {
469 if (is_contained(Ops, i)) {
470470 unsigned SpillSize;
471471 unsigned SpillOffset;
472472 // Compute the spill slot size and offset.
353353 // Check that Phys is in the allocation order. We shouldn't heed hints
354354 // from VirtReg's register class if they aren't in the allocation order. The
355355 // target probably has a reason for removing the register.
356 if (std::find(Order.begin(), Order.end(), Phys) == Order.end())
356 if (!is_contained(Order, Phys))
357357 return;
358358
359359 // All clear, tell the register allocator to prefer this register.
840840 E = HigherLevelAnalysis.end(); I != E; ++I) {
841841 Pass *P1 = *I;
842842 if (P1->getAsImmutablePass() == nullptr &&
843 std::find(PreservedSet.begin(), PreservedSet.end(),
844 P1->getPassID()) ==
845 PreservedSet.end())
843 !is_contained(PreservedSet, P1->getPassID()))
846844 return false;
847845 }
848846
880878 E = AvailableAnalysis.end(); I != E; ) {
881879 DenseMap::iterator Info = I++;
882880 if (Info->second->getAsImmutablePass() == nullptr &&
883 std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
884 PreservedSet.end()) {
881 !is_contained(PreservedSet, Info->first)) {
885882 // Remove this analysis
886883 if (PassDebugging >= Details) {
887884 Pass *S = Info->second;
904901 E = InheritedAnalysis[Index]->end(); I != E; ) {
905902 DenseMap::iterator Info = I++;
906903 if (Info->second->getAsImmutablePass() == nullptr &&
907 std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
908 PreservedSet.end()) {
904 !is_contained(PreservedSet, Info->first)) {
909905 // Remove this analysis
910906 if (PassDebugging >= Details) {
911907 Pass *S = Info->second;
1212 //===----------------------------------------------------------------------===//
1313
1414 #include "llvm/PassRegistry.h"
15 #include "llvm/ADT/STLExtras.h"
1516 #include "llvm/PassSupport.h"
1617 #include "llvm/Support/ManagedStatic.h"
1718
120121 void PassRegistry::removeRegistrationListener(PassRegistrationListener *L) {
121122 sys::SmartScopedWriter Guard(Lock);
122123
123 auto I = std::find(Listeners.begin(), Listeners.end(), L);
124 auto I = find(Listeners, L);
124125 Listeners.erase(I);
125126 }
77 //===----------------------------------------------------------------------===//
88
99 #include "llvm/Option/OptTable.h"
10 #include "llvm/ADT/STLExtras.h"
1011 #include "llvm/Option/Arg.h"
1112 #include "llvm/Option/ArgList.h"
1213 #include "llvm/Option/Option.h"
141142 StringRef Prefix = I->getKey();
142143 for (StringRef::const_iterator C = Prefix.begin(), CE = Prefix.end();
143144 C != CE; ++C)
144 if (std::find(PrefixChars.begin(), PrefixChars.end(), *C)
145 == PrefixChars.end())
145 if (!is_contained(PrefixChars, *C))
146146 PrefixChars.push_back(*C);
147147 }
148148 }
21002100 StringMap
21012101 auto &Subs = GlobalParser->RegisteredSubCommands;
21022102 (void)Subs;
2103 assert(std::find(Subs.begin(), Subs.end(), &Sub) != Subs.end());
2103 assert(is_contained(Subs, &Sub));
21042104 return Sub.OptionsMap;
21052105 }
21062106
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "llvm/Support/YAMLParser.h"
14 #include "llvm/ADT/STLExtras.h"
1415 #include "llvm/ADT/SmallString.h"
1516 #include "llvm/ADT/SmallVector.h"
1617 #include "llvm/ADT/StringExtras.h"
801802 removeStaleSimpleKeyCandidates();
802803 SimpleKey SK;
803804 SK.Tok = TokenQueue.begin();
804 if (std::find(SimpleKeys.begin(), SimpleKeys.end(), SK)
805 == SimpleKeys.end())
805 if (!is_contained(SimpleKeys, SK))
806806 break;
807807 else
808808 NeedMore = true;
49754975
49764976 // Add this element source to the list if it's not already there.
49774977 SDValue SourceVec = V.getOperand(0);
4978 auto Source = std::find(Sources.begin(), Sources.end(), SourceVec);
4978 auto Source = find(Sources, SourceVec);
49794979 if (Source == Sources.end())
49804980 Source = Sources.insert(Sources.end(), ShuffleSourceInfo(SourceVec));
49814981
50915091 if (Entry.isUndef())
50925092 continue;
50935093
5094 auto Src = std::find(Sources.begin(), Sources.end(), Entry.getOperand(0));
5094 auto Src = find(Sources, Entry.getOperand(0));
50955095 int EltNo = cast(Entry.getOperand(1))->getSExtValue();
50965096
50975097 // EXTRACT_VECTOR_ELT performs an implicit any_ext; BUILD_VECTOR an implicit
534534 std::vector &WorkList) const {
535535
536536 for (User *User : Val->users()) {
537 if (std::find(WorkList.begin(), WorkList.end(), User) != WorkList.end())
537 if (is_contained(WorkList, User))
538538 continue;
539539
540540 if (CallInst *CI = dyn_cast(User)) {
199199 .addReg(SubReg)
200200 .addImm(Chan);
201201 UpdatedRegToChan[SubReg] = Chan;
202 std::vector::iterator ChanPos =
203 std::find(UpdatedUndef.begin(), UpdatedUndef.end(), Chan);
202 std::vector::iterator ChanPos = find(UpdatedUndef, Chan);
204203 if (ChanPos != UpdatedUndef.end())
205204 UpdatedUndef.erase(ChanPos);
206 assert(std::find(UpdatedUndef.begin(), UpdatedUndef.end(), Chan) ==
207 UpdatedUndef.end() &&
205 assert(!is_contained(UpdatedUndef, Chan) &&
208206 "UpdatedUndef shouldn't contain Chan more than once!");
209207 DEBUG(dbgs() << " ->"; Tmp->dump(););
210208 (void)Tmp;
235233 for (InstructionSetMap::iterator It = PreviousRegSeqByReg.begin(),
236234 E = PreviousRegSeqByReg.end(); It != E; ++It) {
237235 std::vector &MIs = (*It).second;
238 MIs.erase(std::find(MIs.begin(), MIs.end(), MI), MIs.end());
236 MIs.erase(find(MIs, MI), MIs.end());
239237 }
240238 for (InstructionSetMap::iterator It = PreviousRegSeqByUndefCount.begin(),
241239 E = PreviousRegSeqByUndefCount.end(); It != E; ++It) {
242240 std::vector &MIs = (*It).second;
243 MIs.erase(std::find(MIs.begin(), MIs.end(), MI), MIs.end());
241 MIs.erase(find(MIs, MI), MIs.end());
244242 }
245243 }
246244
362362
363363 std::vector Preds;
364364 for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI) {
365 if (std::find(Latches.begin(), Latches.end(), *PI) == Latches.end())
365 if (!is_contained(Latches, *PI))
366366 Preds.push_back(*PI);
367367 }
368368 BB = llvm::SplitBlockPredecessors(BB, Preds, "endcf.split", DT, LI, false);
478478 void SIScheduleBlock::nodeScheduled(SUnit *SU) {
479479 // Is in TopReadySUs
480480 assert (!SU->NumPredsLeft);
481 std::vector::iterator I =
482 std::find(TopReadySUs.begin(), TopReadySUs.end(), SU);
481 std::vector::iterator I = find(TopReadySUs, SU);
483482 if (I == TopReadySUs.end()) {
484483 dbgs() << "Data Structure Bug in SI Scheduler\n";
485484 llvm_unreachable(nullptr);
288288 }
289289
290290 // First prefer the paired physreg.
291 if (PairedPhys &&
292 std::find(Order.begin(), Order.end(), PairedPhys) != Order.end())
291 if (PairedPhys && is_contained(Order, PairedPhys))
293292 Hints.push_back(PairedPhys);
294293
295294 // Then prefer even or odd registers.
14311431 // it. Check for this so it will be removed from the WaterList.
14321432 // Also remove any entry from NewWaterList.
14331433 MachineBasicBlock *WaterBB = &*--NewMBB->getIterator();
1434 IP = std::find(WaterList.begin(), WaterList.end(), WaterBB);
1434 IP = find(WaterList, WaterBB);
14351435 if (IP != WaterList.end())
14361436 NewWaterList.erase(WaterBB);
14371437
16391639 SavedRegs.set(ARM::LR);
16401640 NumGPRSpills++;
16411641 SmallVectorImpl::iterator LRPos;
1642 LRPos = std::find(UnspilledCS1GPRs.begin(), UnspilledCS1GPRs.end(),
1643 (unsigned)ARM::LR);
1642 LRPos = find(UnspilledCS1GPRs, (unsigned)ARM::LR);
16441643 if (LRPos != UnspilledCS1GPRs.end())
16451644 UnspilledCS1GPRs.erase(LRPos);
16461645
16501649
16511650 if (hasFP(MF)) {
16521651 SavedRegs.set(FramePtr);
1653 auto FPPos = std::find(UnspilledCS1GPRs.begin(), UnspilledCS1GPRs.end(),
1654 FramePtr);
1652 auto FPPos = find(UnspilledCS1GPRs, FramePtr);
16551653 if (FPPos != UnspilledCS1GPRs.end())
16561654 UnspilledCS1GPRs.erase(FPPos);
16571655 NumGPRSpills++;
59145914
59155915 // Add this element source to the list if it's not already there.
59165916 SDValue SourceVec = V.getOperand(0);
5917 auto Source = std::find(Sources.begin(), Sources.end(), SourceVec);
5917 auto Source = find(Sources, SourceVec);
59185918 if (Source == Sources.end())
59195919 Source = Sources.insert(Sources.end(), ShuffleSourceInfo(SourceVec));
59205920
60306030 if (Entry.isUndef())
60316031 continue;
60326032
6033 auto Src = std::find(Sources.begin(), Sources.end(), Entry.getOperand(0));
6033 auto Src = find(Sources, Entry.getOperand(0));
60346034 int EltNo = cast(Entry.getOperand(1))->getSExtValue();
60356035
60366036 // EXTRACT_VECTOR_ELT performs an implicit any_ext; BUILD_VECTOR an implicit
833833 assert(MO.isImplicit());
834834 unsigned DefReg = MO.getReg();
835835
836 if (std::find(ImpDefs.begin(), ImpDefs.end(), DefReg) != ImpDefs.end())
836 if (is_contained(ImpDefs, DefReg))
837837 continue;
838838 // We can ignore cases where the super-reg is read and written.
839839 if (MI->readsRegister(DefReg))
26642664 if (UseI->getOperand(Idx+1).getMBB() != C.LB)
26652665 BadUse = true;
26662666 } else {
2667 auto F = std::find(ShufIns.begin(), ShufIns.end(), UseI);
2667 auto F = find(ShufIns, UseI);
26682668 if (F == ShufIns.end())
26692669 BadUse = true;
26702670 }
9393 void savePacket();
9494 unsigned getTotalPackets() const { return TotalPackets; }
9595
96 bool isInPacket(SUnit *SU) const {
97 return std::find(Packet.begin(), Packet.end(), SU) != Packet.end();
98 }
96 bool isInPacket(SUnit *SU) const { return is_contained(Packet, SU); }
9997 };
10098
10199 /// Extend the standard ScheduleDAGMI to provide more context and override the
13371337 // However, there is no dependence edge between (1)->(3). This results
13381338 // in all 3 instructions going in the same packet. We ignore dependce
13391339 // only once to avoid this situation.
1340 auto Itr = std::find(IgnoreDepMIs.begin(), IgnoreDepMIs.end(), &J);
1340 auto Itr = find(IgnoreDepMIs, &J);
13411341 if (Itr != IgnoreDepMIs.end()) {
13421342 Dependence = true;
13431343 return false;
13731373 // it. Check for this so it will be removed from the WaterList.
13741374 // Also remove any entry from NewWaterList.
13751375 MachineBasicBlock *WaterBB = &*--NewMBB->getIterator();
1376 IP = std::find(WaterList.begin(), WaterList.end(), WaterBB);
1376 IP = find(WaterList, WaterBB);
13771377 if (IP != WaterList.end())
13781378 NewWaterList.erase(WaterBB);
13791379
168168 if (llvm::findAllNVVMAnnotation(
169169 func, llvm::PropertyAnnotationNames[llvm::PROPERTY_ISSAMPLER],
170170 annot)) {
171 if (std::find(annot.begin(), annot.end(), arg->getArgNo()) != annot.end())
171 if (is_contained(annot, arg->getArgNo()))
172172 return true;
173173 }
174174 }
183183 llvm::PropertyAnnotationNames[
184184 llvm::PROPERTY_ISREADONLY_IMAGE_PARAM],
185185 annot)) {
186 if (std::find(annot.begin(), annot.end(), arg->getArgNo()) != annot.end())
186 if (is_contained(annot, arg->getArgNo()))
187187 return true;
188188 }
189189 }
198198 llvm::PropertyAnnotationNames[
199199 llvm::PROPERTY_ISWRITEONLY_IMAGE_PARAM],
200200 annot)) {
201 if (std::find(annot.begin(), annot.end(), arg->getArgNo()) != annot.end())
201 if (is_contained(annot, arg->getArgNo()))
202202 return true;
203203 }
204204 }
213213 llvm::PropertyAnnotationNames[
214214 llvm::PROPERTY_ISREADWRITE_IMAGE_PARAM],
215215 annot)) {
216 if (std::find(annot.begin(), annot.end(), arg->getArgNo()) != annot.end())
216 if (is_contained(annot, arg->getArgNo()))
217217 return true;
218218 }
219219 }
5050 int LEONMachineFunctionPass::getUnusedFPRegister(MachineRegisterInfo &MRI) {
5151 for (int RegisterIndex = SP::F0; RegisterIndex <= SP::F31; ++RegisterIndex) {
5252 if (!MRI.isPhysRegUsed(RegisterIndex) &&
53 !(std::find(UsedRegisters.begin(), UsedRegisters.end(),
54 RegisterIndex) != UsedRegisters.end())) {
53 !is_contained(UsedRegisters, RegisterIndex)) {
5554 return RegisterIndex;
5655 }
5756 }
95529552 auto FixFlippedInputs = [&V, &DL, &Mask, &DAG](int PinnedIdx, int DWord,
95539553 ArrayRef Inputs) {
95549554 int FixIdx = PinnedIdx ^ 1; // The adjacent slot to the pinned slot.
9555 bool IsFixIdxInput = std::find(Inputs.begin(), Inputs.end(),
9556 PinnedIdx ^ 1) != Inputs.end();
9555 bool IsFixIdxInput = is_contained(Inputs, PinnedIdx ^ 1);
95579556 // Determine whether the free index is in the flipped dword or the
95589557 // unflipped dword based on where the pinned index is. We use this bit
95599558 // in an xor to conditionally select the adjacent dword.
95609559 int FixFreeIdx = 2 * (DWord ^ (PinnedIdx / 2 == DWord));
9561 bool IsFixFreeIdxInput = std::find(Inputs.begin(), Inputs.end(),
9562 FixFreeIdx) != Inputs.end();
9560 bool IsFixFreeIdxInput = is_contained(Inputs, FixFreeIdx);
95639561 if (IsFixIdxInput == IsFixFreeIdxInput)
95649562 FixFreeIdx += 1;
9565 IsFixFreeIdxInput = std::find(Inputs.begin(), Inputs.end(),
9566 FixFreeIdx) != Inputs.end();
9563 IsFixFreeIdxInput = is_contained(Inputs, FixFreeIdx);
95679564 assert(IsFixIdxInput != IsFixFreeIdxInput &&
95689565 "We need to be changing the number of flipped inputs!");
95699566 int PSHUFHalfMask[] = {0, 1, 2, 3};
11661166 for (unsigned i = 0; ; ++i) {
11671167 assert(i != TI->getNumSuccessors() && "Didn't find any successor!");
11681168
1169 if (std::find(SamePopularity.begin(), SamePopularity.end(),
1170 TI->getSuccessor(i)) == SamePopularity.end())
1169 if (!is_contained(SamePopularity, TI->getSuccessor(i)))
11711170 continue;
11721171
11731172 MostPopularDest = TI->getSuccessor(i);
877877
878878 for (User *V : I->users()) {
879879 Instruction *I = dyn_cast(V);
880 if (std::find(LoopIncs.begin(), LoopIncs.end(), I) != LoopIncs.end())
880 if (is_contained(LoopIncs, I))
881881 continue;
882882
883883 if (!I || !isSimpleArithmeticOp(I) ||
10871087
10881088 bool LoopReroll::DAGRootTracker::isRootInst(Instruction *I) {
10891089 for (auto &DRS : RootSets) {
1090 if (std::find(DRS.Roots.begin(), DRS.Roots.end(), I) != DRS.Roots.end())
1090 if (is_contained(DRS.Roots, I))
10911091 return true;
10921092 }
10931093 return false;
447447
448448 /// Test if this formula references the given register.
449449 bool Formula::referencesReg(const SCEV *S) const {
450 return S == ScaledReg ||
451 std::find(BaseRegs.begin(), BaseRegs.end(), S) != BaseRegs.end();
450 return S == ScaledReg || is_contained(BaseRegs, S);
452451 }
453452
454453 /// Test whether this formula uses registers which are used by uses other than
42304229 int NumReqRegsToFind = std::min(F.getNumRegs(), ReqRegs.size());
42314230 for (const SCEV *Reg : ReqRegs) {
42324231 if ((F.ScaledReg && F.ScaledReg == Reg) ||
4233 std::find(F.BaseRegs.begin(), F.BaseRegs.end(), Reg) !=
4234 F.BaseRegs.end()) {
4232 is_contained(F.BaseRegs, Reg)) {
42354233 --NumReqRegsToFind;
42364234 if (NumReqRegsToFind == 0)
42374235 break;
11531153 return;
11541154
11551155 auto FindIndex = [](ArrayRef LiveVec, Value *Val) {
1156 auto ValIt = std::find(LiveVec.begin(), LiveVec.end(), Val);
1156 auto ValIt = find(LiveVec, Val);
11571157 assert(ValIt != LiveVec.end() && "Val not found in LiveVec!");
11581158 size_t Index = std::distance(LiveVec.begin(), ValIt);
11591159 assert(Index < LiveVec.size() && "Bug in std::find?");
19281928 // Assert that cloned instruction does not use any instructions from
19291929 // this chain other than LastClonedValue
19301930 for (auto OpValue : ClonedValue->operand_values()) {
1931 assert(std::find(ChainToBase.begin(), ChainToBase.end(), OpValue) ==
1932 ChainToBase.end() &&
1931 assert(!is_contained(ChainToBase, OpValue) &&
19331932 "incorrect use in rematerialization chain");
19341933 }
19351934 #endif
320320 BasicBlock *BB = (*I)->getEntry();
321321 unsigned LoopDepth = LI->getLoopDepth(BB);
322322
323 if (std::find(Order.begin(), Order.end(), *I) != Order.end())
323 if (is_contained(Order, *I))
324324 continue;
325325
326326 if (LoopDepth < CurrentLoopDepth) {
536536 const SmallVectorImpl &ActualArgs) {
537537 // Check to see if this function is already executing (recursion). If so,
538538 // bail out. TODO: we might want to accept limited recursion.
539 if (std::find(CallStack.begin(), CallStack.end(), F) != CallStack.end())
539 if (is_contained(CallStack, F))
540540 return false;
541541
542542 CallStack.push_back(F);
5353 /// Return true if the specified block is in the list.
5454 static bool isExitBlock(BasicBlock *BB,
5555 const SmallVectorImpl &ExitBlocks) {
56 return find(ExitBlocks, BB) != ExitBlocks.end();
56 return is_contained(ExitBlocks, BB);
5757 }
5858
5959 /// For every instruction from the worklist, check to see if it has any uses
481481 LoadAndStorePromoter::isInstInList(Instruction *I,
482482 const SmallVectorImpl &Insts)
483483 const {
484 return std::find(Insts.begin(), Insts.end(), I) != Insts.end();
485 }
484 return is_contained(Insts, I);
485 }
953953 }
954954
955955 // Ignore users in the user ignore list.
956 if (std::find(UserIgnoreList.begin(), UserIgnoreList.end(), UserInst) !=
957 UserIgnoreList.end())
956 if (is_contained(UserIgnoreList, UserInst))
958957 continue;
959958
960959 DEBUG(dbgs() << "SLP: Need to extract:" << *U << " from lane " <<
27252724
27262725 assert((ScalarToTreeEntry.count(U) ||
27272726 // It is legal to replace users in the ignorelist by undef.
2728 (std::find(UserIgnoreList.begin(), UserIgnoreList.end(), U) !=
2729 UserIgnoreList.end())) &&
2727 is_contained(UserIgnoreList, U)) &&
27302728 "Replacing out-of-tree value with undef");
27312729 }
27322730 #endif
28192817 }
28202818 }
28212819 if (In) {
2822 assert(std::find(Visited.begin(), Visited.end(), In) == Visited.end());
2820 assert(!is_contained(Visited, In));
28232821 Visited.push_back(In);
28242822 }
28252823 }
238238
239239 bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) {
240240 // If main isn't present, claim there is no problem.
241 if (KeepMain && std::find(Funcs.begin(), Funcs.end(),
242 BD.getProgram()->getFunction("main")) ==
243 Funcs.end())
241 if (KeepMain && !is_contained(Funcs, BD.getProgram()->getFunction("main")))
244242 return false;
245243
246244 // Clone the program to try hacking it apart...
284284 }
285285
286286 static bool shouldLinkArch(SmallVectorImpl &Archs, StringRef Arch) {
287 if (Archs.empty() ||
288 std::find(Archs.begin(), Archs.end(), "all") != Archs.end() ||
289 std::find(Archs.begin(), Archs.end(), "*") != Archs.end())
287 if (Archs.empty() || is_contained(Archs, "all") || is_contained(Archs, "*"))
290288 return true;
291289
292 if (Arch.startswith("arm") && Arch != "arm64" &&
293 std::find(Archs.begin(), Archs.end(), "arm") != Archs.end())
290 if (Arch.startswith("arm") && Arch != "arm64" && is_contained(Archs, "arm"))
294291 return true;
295292
296293 SmallString<16> ArchName = Arch;
297294 if (Arch.startswith("thumb"))
298295 ArchName = ("arm" + Arch.substr(5)).str();
299296
300 return std::find(Archs.begin(), Archs.end(), ArchName) != Archs.end();
297 return is_contained(Archs, ArchName);
301298 }
302299
303300 bool MachODebugMapParser::dumpStab() {
428428 StringRef Name = NameOrErr.get();
429429
430430 if (Filter) {
431 auto I = std::find(Members.begin(), Members.end(), Name);
431 auto I = find(Members, Name);
432432 if (I == Members.end())
433433 continue;
434434 Members.erase(I);
1414 #ifndef LLVM_UNITTESTS_EXECUTIONENGINE_MCJIT_MCJITTESTAPICOMMON_H
1515 #define LLVM_UNITTESTS_EXECUTIONENGINE_MCJIT_MCJITTESTAPICOMMON_H
1616
17 #include "llvm/ADT/STLExtras.h"
1718 #include "llvm/ADT/SmallVector.h"
1819 #include "llvm/ADT/Triple.h"
1920 #include "llvm/IR/LegacyPassManager.h"
5556 bool ArchSupportsMCJIT() {
5657 Triple Host(HostTriple);
5758 // If ARCH is not supported, bail
58 if (std::find(SupportedArchs.begin(), SupportedArchs.end(), Host.getArch())
59 == SupportedArchs.end())
59 if (!is_contained(SupportedArchs, Host.getArch()))
6060 return false;
6161
6262 // If ARCH is supported and has no specific sub-arch support
63 if (std::find(HasSubArchs.begin(), HasSubArchs.end(), Host.getArch())
64 == HasSubArchs.end())
63 if (!is_contained(HasSubArchs, Host.getArch()))
6564 return true;
6665
6766 // If ARCH has sub-arch support, find it
7776 bool OSSupportsMCJIT() {
7877 Triple Host(HostTriple);
7978
80 if (std::find(UnsupportedEnvironments.begin(), UnsupportedEnvironments.end(),
81 Host.getEnvironment()) != UnsupportedEnvironments.end())
79 if (find(UnsupportedEnvironments, Host.getEnvironment()) !=
80 UnsupportedEnvironments.end())
8281 return false;
8382
84 if (std::find(UnsupportedOSs.begin(), UnsupportedOSs.end(), Host.getOS())
85 == UnsupportedOSs.end())
83 if (!is_contained(UnsupportedOSs, Host.getOS()))
8684 return true;
8785
8886 return false;
77 //===----------------------------------------------------------------------===//
88
99 #include "llvm/Support/Path.h"
10 #include "llvm/ADT/STLExtras.h"
1011 #include "llvm/Support/ConvertUTF.h"
1112 #include "llvm/Support/Errc.h"
1213 #include "llvm/Support/ErrorHandling.h"
676677 i.no_push();
677678 visited.push_back(path::filename(i->path()));
678679 }
679 v_t::const_iterator a0 = std::find(visited.begin(), visited.end(), "a0");
680 v_t::const_iterator aa1 = std::find(visited.begin(), visited.end(), "aa1");
681 v_t::const_iterator ab1 = std::find(visited.begin(), visited.end(), "ab1");
682 v_t::const_iterator dontlookhere = std::find(visited.begin(), visited.end(),
683 "dontlookhere");
684 v_t::const_iterator da1 = std::find(visited.begin(), visited.end(), "da1");
685 v_t::const_iterator z0 = std::find(visited.begin(), visited.end(), "z0");
686 v_t::const_iterator za1 = std::find(visited.begin(), visited.end(), "za1");
687 v_t::const_iterator pop = std::find(visited.begin(), visited.end(), "pop");
688 v_t::const_iterator p1 = std::find(visited.begin(), visited.end(), "p1");
680 v_t::const_iterator a0 = find(visited, "a0");
681 v_t::const_iterator aa1 = find(visited, "aa1");
682 v_t::const_iterator ab1 = find(visited, "ab1");
683 v_t::const_iterator dontlookhere = find(visited, "dontlookhere");
684 v_t::const_iterator da1 = find(visited, "da1");
685 v_t::const_iterator z0 = find(visited, "z0");
686 v_t::const_iterator za1 = find(visited, "za1");
687 v_t::const_iterator pop = find(visited, "pop");
688 v_t::const_iterator p1 = find(visited, "p1");
689689
690690 // Make sure that each path was visited correctly.
691691 ASSERT_NE(a0, visited.end());
3030 bool isUnsupportedOSOrEnvironment() {
3131 Triple Host(Triple::normalize(sys::getProcessTriple()));
3232
33 if (std::find(UnsupportedEnvironments.begin(), UnsupportedEnvironments.end(),
34 Host.getEnvironment()) != UnsupportedEnvironments.end())
33 if (find(UnsupportedEnvironments, Host.getEnvironment()) !=
34 UnsupportedEnvironments.end())
3535 return true;
3636
37 if (std::find(UnsupportedOSs.begin(), UnsupportedOSs.end(), Host.getOS())
38 != UnsupportedOSs.end())
37 if (is_contained(UnsupportedOSs, Host.getOS()))
3938 return true;
4039
41 if (std::find(UnsupportedArchs.begin(), UnsupportedArchs.end(), Host.getArch())
42 != UnsupportedArchs.end())
40 if (is_contained(UnsupportedArchs, Host.getArch()))
4341 return true;
4442
4543 return false;
18181818 bool &IsNew) {
18191819 IsNew = Table.insert(Name);
18201820
1821 unsigned ID = IsNew ? Table.size() - 1 :
1822 std::find(Table.begin(), Table.end(), Name) - Table.begin();
1821 unsigned ID = IsNew ? Table.size() - 1 : find(Table, Name) - Table.begin();
18231822
18241823 assert(ID < Table.size());
18251824
411411 }
412412 void addPredicateFn(const TreePredicateFn &Fn) {
413413 assert(!Fn.isAlwaysTrue() && "Empty predicate string!");
414 if (std::find(PredicateFns.begin(), PredicateFns.end(), Fn) ==
415 PredicateFns.end())
414 if (!is_contained(PredicateFns, Fn))
416415 PredicateFns.push_back(Fn);
417416 }
418417
17551755 std::vector RUSets;
17561756 for (unsigned i = 0, e = RegUnitSets.size(); i != e; ++i) {
17571757 RegUnitSet &RUSet = RegUnitSets[i];
1758 if (std::find(RUSet.Units.begin(), RUSet.Units.end(), UnitIdx)
1759 == RUSet.Units.end())
1758 if (!is_contained(RUSet.Units, UnitIdx))
17601759 continue;
17611760 RUSets.push_back(i);
17621761 }
355355 continue;
356356
357357 RecVec ValidWrites = ReadDef->getValueAsListOfDefs("ValidWrites");
358 if (std::find(ValidWrites.begin(), ValidWrites.end(), WriteDef)
359 != ValidWrites.end()) {
358 if (is_contained(ValidWrites, WriteDef)) {
360359 return true;
361360 }
362361 }
13991398 PM.ProcResourceDefs[i]->getValueAsListOfDefs("Resources");
14001399 RecIter RI = SubUnits.begin(), RE = SubUnits.end();
14011400 for ( ; RI != RE; ++RI) {
1402 if (std::find(SuperUnits.begin(), SuperUnits.end(), *RI)
1403 == SuperUnits.end()) {
1401 if (!is_contained(SuperUnits, *RI)) {
14041402 break;
14051403 }
14061404 }
17401738 assert(PIdx && "don't add resources to an invalid Processor model");
17411739
17421740 RecVec &WRDefs = ProcModels[PIdx].WriteResDefs;
1743 RecIter WRI = std::find(WRDefs.begin(), WRDefs.end(), ProcWriteResDef);
1741 RecIter WRI = find(WRDefs, ProcWriteResDef);
17441742 if (WRI != WRDefs.end())
17451743 return;
17461744 WRDefs.push_back(ProcWriteResDef);
17571755 void CodeGenSchedModels::addReadAdvance(Record *ProcReadAdvanceDef,
17581756 unsigned PIdx) {
17591757 RecVec &RADefs = ProcModels[PIdx].ReadAdvanceDefs;
1760 RecIter I = std::find(RADefs.begin(), RADefs.end(), ProcReadAdvanceDef);
1758 RecIter I = find(RADefs, ProcReadAdvanceDef);
17611759 if (I != RADefs.end())
17621760 return;
17631761 RADefs.push_back(ProcReadAdvanceDef);
17641762 }
17651763
17661764 unsigned CodeGenProcModel::getProcResourceIdx(Record *PRDef) const {
1767 RecIter PRPos = std::find(ProcResourceDefs.begin(), ProcResourceDefs.end(),
1768 PRDef);
1765 RecIter PRPos = find(ProcResourceDefs, PRDef);
17691766 if (PRPos == ProcResourceDefs.end())
17701767 PrintFatalError(PRDef->getLoc(), "ProcResource def is not included in "
17711768 "the ProcResources list for " + ModelName);
138138 /// supported by the target (i.e. there are registers that directly hold it).
139139 bool isLegalValueType(MVT::SimpleValueType VT) const {
140140 ArrayRef LegalVTs = getLegalValueTypes();
141 return std::find(LegalVTs.begin(), LegalVTs.end(), VT) != LegalVTs.end();
141 return is_contained(LegalVTs, VT);
142142 }
143143
144144 CodeGenSchedModels &getSchedModels() const;
782782 RecVec SuperResources = PR->getValueAsListOfDefs("Resources");
783783 RecIter SubI = SubResources.begin(), SubE = SubResources.end();
784784 for( ; SubI != SubE; ++SubI) {
785 if (std::find(SuperResources.begin(), SuperResources.end(), *SubI)
786 == SuperResources.end()) {
785 if (!is_contained(SuperResources, *SubI)) {
787786 break;
788787 }
789788 }
872871 // Check this processor's itinerary class resources.
873872 for (Record *I : ProcModel.ItinRWDefs) {
874873 RecVec Matched = I->getValueAsListOfDefs("MatchedItinClasses");
875 if (std::find(Matched.begin(), Matched.end(), SC.ItinClassDef)
876 != Matched.end()) {
874 if (is_contained(Matched, SC.ItinClassDef)) {
877875 SchedModels.findRWs(I->getValueAsListOfDefs("OperandReadWrites"),
878876 Writes, Reads);
879877 break;