llvm.org GIT mirror llvm / 53a6224
Use llvm::copy. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347126 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 2 years ago
22 changed file(s) with 38 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
419419
420420 // We've computed the grouped checks for this partition.
421421 // Save the results and continue with the next one.
422 std::copy(Groups.begin(), Groups.end(), std::back_inserter(CheckingGroups));
422 llvm::copy(Groups, std::back_inserter(CheckingGroups));
423423 }
424424 }
425425
9292 // FIXME: Figure out whether this is dead code and if so remove it.
9393 if (!std::equal(Phi->op_begin(), Phi->op_end(), PhiOps.begin())) {
9494 // These will have been filled in by the recursive read we did above.
95 std::copy(PhiOps.begin(), PhiOps.end(), Phi->op_begin());
95 llvm::copy(PhiOps, Phi->op_begin());
9696 std::copy(pred_begin(BB), pred_end(BB), Phi->block_begin());
9797 }
9898 } else {
40254025
40264026 if (ModHash)
40274027 // Save the written hash value.
4028 std::copy(std::begin(Vals), std::end(Vals), std::begin(*ModHash));
4028 llvm::copy(Vals, std::begin(*ModHash));
40294029 }
40304030 }
40314031
214214 unsigned Idx = 0;
215215 while (auto Elt = C.getAggregateElement(Idx++)) {
216216 auto EltRegs = getOrCreateVRegs(*Elt);
217 std::copy(EltRegs.begin(), EltRegs.end(), std::back_inserter(*VRegs));
217 llvm::copy(EltRegs, std::back_inserter(*VRegs));
218218 }
219219 } else {
220220 assert(SplitTys.size() == 1 && "unexpectedly split LLT");
676676
677677 std::vector Candidates = populateCandidates(MBB);
678678 std::vector VisitedMIs;
679 std::copy(Candidates.begin(), Candidates.end(),
680 std::back_inserter(VisitedMIs));
679 llvm::copy(Candidates, std::back_inserter(VisitedMIs));
681680
682681 std::vector VRegs;
683682 for (auto candidate : Candidates) {
434434
435435 const char *MachineFunction::createExternalSymbolName(StringRef Name) {
436436 char *Dest = Allocator.Allocate(Name.size() + 1);
437 std::copy(Name.begin(), Name.end(), Dest);
437 llvm::copy(Name, Dest);
438438 Dest[Name.size()] = 0;
439439 return Dest;
440440 }
217217 // The trace tail is done.
218218 if (!TBI->Succ) {
219219 TBI->Tail = MBB->getNumber();
220 std::copy(PRCycles.begin(), PRCycles.end(),
221 ProcResourceHeights.begin() + PROffset);
220 llvm::copy(PRCycles, ProcResourceHeights.begin() + PROffset);
222221 return;
223222 }
224223
16841684 // SDNode doesn't have access to it. This memory will be "leaked" when
16851685 // the node is deallocated, but recovered when the NodeAllocator is released.
16861686 int *MaskAlloc = OperandAllocator.Allocate(NElts);
1687 std::copy(MaskVec.begin(), MaskVec.end(), MaskAlloc);
1687 llvm::copy(MaskVec, MaskAlloc);
16881688
16891689 auto *N = newSDNode(VT, dl.getIROrder(),
16901690 dl.getDebugLoc(), MaskAlloc);
70387038 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
70397039 if (!Result) {
70407040 EVT *Array = Allocator.Allocate(NumVTs);
7041 std::copy(VTs.begin(), VTs.end(), Array);
7041 llvm::copy(VTs, Array);
70427042 Result = new (Allocator) SDVTListNode(ID.Intern(Allocator), Array, NumVTs);
70437043 VTListMap.InsertNode(Result, IP);
70447044 }
71847184
71857185 MachineMemOperand **MemRefsBuffer =
71867186 Allocator.template Allocate(NewMemRefs.size());
7187 std::copy(NewMemRefs.begin(), NewMemRefs.end(), MemRefsBuffer);
7187 llvm::copy(NewMemRefs, MemRefsBuffer);
71887188 N->MemRefs = MemRefsBuffer;
71897189 N->NumMemRefs = static_cast(NewMemRefs.size());
71907190 }
123123 StringRef str = Data.getData().substr(*Offset, Bytes);
124124 *Offset += Bytes;
125125 E.Loc.reserve(str.size());
126 std::copy(str.begin(), str.end(), std::back_inserter(E.Loc));
126 llvm::copy(str, std::back_inserter(E.Loc));
127127 LL.Entries.push_back(std::move(E));
128128 }
129129 }
188188 StringRef str = Data.getData().substr(*Offset, Bytes);
189189 *Offset += Bytes;
190190 E.Loc.resize(str.size());
191 std::copy(str.begin(), str.end(), E.Loc.begin());
191 llvm::copy(str, E.Loc.begin());
192192 }
193193
194194 LL.Entries.push_back(std::move(E));
638638 AttributeSetNode::AttributeSetNode(ArrayRef Attrs)
639639 : AvailableAttrs(0), NumAttrs(Attrs.size()) {
640640 // There's memory after the node where we can store the entries in.
641 std::copy(Attrs.begin(), Attrs.end(), getTrailingObjects());
641 llvm::copy(Attrs, getTrailingObjects());
642642
643643 for (const auto I : *this) {
644644 if (!I.isStringAttribute()) {
808808 assert(!Sets.empty() && "pointless AttributeListImpl");
809809
810810 // There's memory after the node where we can store the entries in.
811 std::copy(Sets.begin(), Sets.end(), getTrailingObjects());
811 llvm::copy(Sets, getTrailingObjects());
812812
813813 // Initialize AvailableFunctionAttrs summary bitset.
814814 static_assert(Attribute::EndAttrKinds <=
939939 ArrayRef V)
940940 : Constant(T, VT, OperandTraits::op_end(this) - V.size(),
941941 V.size()) {
942 std::copy(V.begin(), V.end(), op_begin());
942 llvm::copy(V, op_begin());
943943
944944 // Check that types match, unless this is an opaque struct.
945945 if (auto *ST = dyn_cast(T))
274274 "Calling a function with a bad signature!");
275275 #endif
276276
277 std::copy(Args.begin(), Args.end(), op_begin());
277 llvm::copy(Args, op_begin());
278278
279279 auto It = populateBundleOperandInfos(Bundles, Args.size());
280280 (void)It;
576576 "Invoking a function with a bad signature!");
577577 #endif
578578
579 std::copy(Args.begin(), Args.end(), op_begin());
579 llvm::copy(Args, op_begin());
580580
581581 auto It = populateBundleOperandInfos(Bundles, Args.size());
582582 (void)It;
833833 void FuncletPadInst::init(Value *ParentPad, ArrayRef Args,
834834 const Twine &NameStr) {
835835 assert(getNumOperands() == 1 + Args.size() && "NumOperands not set up?");
836 std::copy(Args.begin(), Args.end(), op_begin());
836 llvm::copy(Args, op_begin());
837837 setParentPad(ParentPad);
838838 setName(NameStr);
839839 }
13891389 assert(getNumOperands() == 1 + IdxList.size() &&
13901390 "NumOperands not initialized?");
13911391 Op<0>() = Ptr;
1392 std::copy(IdxList.begin(), IdxList.end(), op_begin() + 1);
1392 llvm::copy(IdxList, op_begin() + 1);
13931393 setName(Name);
13941394 }
13951395
14831483 std::vector Elements(OrigElements.size() + 2);
14841484 Elements[0] = dwarf::DW_OP_plus_uconst;
14851485 Elements[1] = Offset;
1486 std::copy(OrigElements.begin(), OrigElements.end(), Elements.begin() + 2);
1486 llvm::copy(OrigElements, Elements.begin() + 2);
14871487 E = DIExpression::get(getContext(), Elements);
14881488 Attachment = DIGlobalVariableExpression::get(getContext(), GV, E);
14891489 }
228228 SmallVector ret;
229229 (*unwrap(RI))->getTypeName(ret);
230230 char *str = static_cast(safe_malloc(ret.size()));
231 std::copy(ret.begin(), ret.end(), str);
231 llvm::copy(ret, str);
232232 return str;
233233 }
234234
258258 std::vector EndianCorrectedName;
259259 if (sys::IsBigEndianHost) {
260260 EndianCorrectedName.resize(NameRef.size() + 1);
261 std::copy(NameRef.begin(), NameRef.end(), EndianCorrectedName.begin() + 1);
261 llvm::copy(NameRef, EndianCorrectedName.begin() + 1);
262262 EndianCorrectedName[0] = UNI_UTF16_BYTE_ORDER_MARK_SWAPPED;
263263 CorrectedName = makeArrayRef(EndianCorrectedName);
264264 } else
500500 void WindowsResourceCOFFWriter::writeSecondSection() {
501501 // Now write the .rsrc$02 section.
502502 for (auto const &RawDataEntry : Data) {
503 std::copy(RawDataEntry.begin(), RawDataEntry.end(),
504 BufferStart + CurrentOffset);
503 llvm::copy(RawDataEntry, BufferStart + CurrentOffset);
505504 CurrentOffset += alignTo(RawDataEntry.size(), sizeof(uint64_t));
506505 }
507506
671670 support::endian::write16le(BufferStart + CurrentOffset, Length);
672671 CurrentOffset += sizeof(uint16_t);
673672 auto *Start = reinterpret_cast(BufferStart + CurrentOffset);
674 std::copy(String.begin(), String.end(), Start);
673 llvm::copy(String, Start);
675674 CurrentOffset += Length * sizeof(UTF16);
676675 TotalStringTableSize += Length * sizeof(UTF16) + sizeof(uint16_t);
677676 }
532532
533533 // If prefixes have the same size we can simply copy the new one over.
534534 if (OldPrefix.size() == NewPrefix.size()) {
535 std::copy(NewPrefix.begin(), NewPrefix.end(), Path.begin());
535 llvm::copy(NewPrefix, Path.begin());
536536 return;
537537 }
538538
4848 Data[0] = Seed;
4949 Data[1] = Seed >> 32;
5050
51 std::copy(Salt.begin(), Salt.end(), Data.begin() + 2);
51 llvm::copy(Salt, Data.begin() + 2);
5252
5353 std::seed_seq SeedSeq(Data.begin(), Data.end());
5454 Generator.seed(SeedSeq);
3735037350 if (!LHS.getOperand(1).isUndef())
3735137351 B = LHS.getOperand(1);
3735237352 ArrayRef Mask = cast(LHS.getNode())->getMask();
37353 std::copy(Mask.begin(), Mask.end(), LMask.begin());
37353 llvm::copy(Mask, LMask.begin());
3735437354 } else {
3735537355 A = LHS;
3735637356 for (unsigned i = 0; i != NumElts; ++i)
3736737367 if (!RHS.getOperand(1).isUndef())
3736837368 D = RHS.getOperand(1);
3736937369 ArrayRef Mask = cast(RHS.getNode())->getMask();
37370 std::copy(Mask.begin(), Mask.end(), RMask.begin());
37370 llvm::copy(Mask, RMask.begin());
3737137371 } else {
3737237372 C = RHS;
3737337373 for (unsigned i = 0; i != NumElts; ++i)
14151415 void CHR::sortScopes(SmallVectorImpl &Input,
14161416 SmallVectorImpl &Output) {
14171417 Output.resize(Input.size());
1418 std::copy(Input.begin(), Input.end(), Output.begin());
1418 llvm::copy(Input, Output.begin());
14191419 std::stable_sort(Output.begin(), Output.end(), CHRScopeSorter);
14201420 }
14211421
257257 /// Create a PHI from an array of incoming values and incoming blocks.
258258 template
259259 ModelledPHI(const VArray &V, const BArray &B) {
260 std::copy(V.begin(), V.end(), std::back_inserter(Values));
261 std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
260 llvm::copy(V, std::back_inserter(Values));
261 llvm::copy(B, std::back_inserter(Blocks));
262262 }
263263
264264 /// Create a PHI from [I[OpNum] for I in Insts].
265265 template
266266 ModelledPHI(ArrayRef Insts, unsigned OpNum, const BArray &B) {
267 std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
267 llvm::copy(B, std::back_inserter(Blocks));
268268 for (auto *I : Insts)
269269 Values.push_back(I->getOperand(OpNum));
270270 }
31743174 auto FilteredPhiArgs =
31753175 make_filter_range(MP->operands(), ReachableOperandPred);
31763176 SmallVector OperandList;
3177 std::copy(FilteredPhiArgs.begin(), FilteredPhiArgs.end(),
3178 std::back_inserter(OperandList));
3177 llvm::copy(FilteredPhiArgs, std::back_inserter(OperandList));
31793178 bool Okay = is_splat(OperandList);
31803179 if (Okay)
31813180 return singleReachablePHIPath(Visited, cast(OperandList[0]),
9696 if (Sec.Type == SHT_NOBITS)
9797 return;
9898 uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
99 std::copy(std::begin(Sec.Contents), std::end(Sec.Contents), Buf);
99 llvm::copy(Sec.Contents, Buf);
100100 }
101101
102102 void Section::accept(SectionVisitor &Visitor) const { Visitor.visit(*this); }
103103
104104 void SectionWriter::visit(const OwnedDataSection &Sec) {
105105 uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
106 std::copy(std::begin(Sec.Data), std::end(Sec.Data), Buf);
106 llvm::copy(Sec.Data, Buf);
107107 }
108108
109109 static const std::vector ZlibGnuMagic = {'Z', 'L', 'I', 'B'};
268268 void ELFSectionWriter::visit(const SectionIndexSection &Sec) {
269269 uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
270270 auto *IndexesBuffer = reinterpret_cast(Buf);
271 std::copy(std::begin(Sec.Indexes), std::end(Sec.Indexes), IndexesBuffer);
271 llvm::copy(Sec.Indexes, IndexesBuffer);
272272 }
273273
274274 void SectionIndexSection::initialize(SectionTableRef SecTable) {
553553 }
554554
555555 void SectionWriter::visit(const DynamicRelocationSection &Sec) {
556 std::copy(std::begin(Sec.Contents), std::end(Sec.Contents),
556 llvm::copy(Sec.Contents,
557557 Out.getBufferStart() + Sec.Offset);
558558 }
559559
640640 Elf_Word *CRC =
641641 reinterpret_cast(Buf + Sec.Size - sizeof(Elf_Word));
642642 *CRC = Sec.CRC32;
643 std::copy(std::begin(Sec.FileName), std::end(Sec.FileName), File);
643 llvm::copy(Sec.FileName, File);
644644 }
645645
646646 void GnuDebugLinkSection::accept(SectionVisitor &Visitor) const {