Skip to content

Commit 7570932

Browse files
committed
Use llvm::copy. NFC
llvm-svn: 347126
1 parent a900471 commit 7570932

22 files changed

+38
-42
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void RuntimePointerChecking::groupChecks(
420420

421421
// We've computed the grouped checks for this partition.
422422
// Save the results and continue with the next one.
423-
std::copy(Groups.begin(), Groups.end(), std::back_inserter(CheckingGroups));
423+
llvm::copy(Groups, std::back_inserter(CheckingGroups));
424424
}
425425
}
426426

llvm/lib/Analysis/MemorySSAUpdater.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ MemoryAccess *MemorySSAUpdater::getPreviousDefRecursive(
9393
// FIXME: Figure out whether this is dead code and if so remove it.
9494
if (!std::equal(Phi->op_begin(), Phi->op_end(), PhiOps.begin())) {
9595
// These will have been filled in by the recursive read we did above.
96-
std::copy(PhiOps.begin(), PhiOps.end(), Phi->op_begin());
96+
llvm::copy(PhiOps, Phi->op_begin());
9797
std::copy(pred_begin(BB), pred_end(BB), Phi->block_begin());
9898
}
9999
} else {

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4026,7 +4026,7 @@ void ModuleBitcodeWriter::writeModuleHash(size_t BlockStartPos) {
40264026

40274027
if (ModHash)
40284028
// Save the written hash value.
4029-
std::copy(std::begin(Vals), std::end(Vals), std::begin(*ModHash));
4029+
llvm::copy(Vals, std::begin(*ModHash));
40304030
}
40314031
}
40324032

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ ArrayRef<unsigned> IRTranslator::getOrCreateVRegs(const Value &Val) {
215215
unsigned Idx = 0;
216216
while (auto Elt = C.getAggregateElement(Idx++)) {
217217
auto EltRegs = getOrCreateVRegs(*Elt);
218-
std::copy(EltRegs.begin(), EltRegs.end(), std::back_inserter(*VRegs));
218+
llvm::copy(EltRegs, std::back_inserter(*VRegs));
219219
}
220220
} else {
221221
assert(SplitTys.size() == 1 && "unexpectedly split LLT");

llvm/lib/CodeGen/MIRCanonicalizerPass.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,7 @@ static bool runOnBasicBlock(MachineBasicBlock *MBB,
677677

678678
std::vector<MachineInstr *> Candidates = populateCandidates(MBB);
679679
std::vector<MachineInstr *> VisitedMIs;
680-
std::copy(Candidates.begin(), Candidates.end(),
681-
std::back_inserter(VisitedMIs));
680+
llvm::copy(Candidates, std::back_inserter(VisitedMIs));
682681

683682
std::vector<TypedVReg> VRegs;
684683
for (auto candidate : Candidates) {

llvm/lib/CodeGen/MachineFunction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ MachineFunction::createMIExtraInfo(ArrayRef<MachineMemOperand *> MMOs,
435435

436436
const char *MachineFunction::createExternalSymbolName(StringRef Name) {
437437
char *Dest = Allocator.Allocate<char>(Name.size() + 1);
438-
std::copy(Name.begin(), Name.end(), Dest);
438+
llvm::copy(Name, Dest);
439439
Dest[Name.size()] = 0;
440440
return Dest;
441441
}

llvm/lib/CodeGen/MachineTraceMetrics.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ computeHeightResources(const MachineBasicBlock *MBB) {
218218
// The trace tail is done.
219219
if (!TBI->Succ) {
220220
TBI->Tail = MBB->getNumber();
221-
std::copy(PRCycles.begin(), PRCycles.end(),
222-
ProcResourceHeights.begin() + PROffset);
221+
llvm::copy(PRCycles, ProcResourceHeights.begin() + PROffset);
223222
return;
224223
}
225224

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ SDValue SelectionDAG::getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1,
16851685
// SDNode doesn't have access to it. This memory will be "leaked" when
16861686
// the node is deallocated, but recovered when the NodeAllocator is released.
16871687
int *MaskAlloc = OperandAllocator.Allocate<int>(NElts);
1688-
std::copy(MaskVec.begin(), MaskVec.end(), MaskAlloc);
1688+
llvm::copy(MaskVec, MaskAlloc);
16891689

16901690
auto *N = newSDNode<ShuffleVectorSDNode>(VT, dl.getIROrder(),
16911691
dl.getDebugLoc(), MaskAlloc);
@@ -7039,7 +7039,7 @@ SDVTList SelectionDAG::getVTList(ArrayRef<EVT> VTs) {
70397039
SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
70407040
if (!Result) {
70417041
EVT *Array = Allocator.Allocate<EVT>(NumVTs);
7042-
std::copy(VTs.begin(), VTs.end(), Array);
7042+
llvm::copy(VTs, Array);
70437043
Result = new (Allocator) SDVTListNode(ID.Intern(Allocator), Array, NumVTs);
70447044
VTListMap.InsertNode(Result, IP);
70457045
}
@@ -7185,7 +7185,7 @@ void SelectionDAG::setNodeMemRefs(MachineSDNode *N,
71857185

71867186
MachineMemOperand **MemRefsBuffer =
71877187
Allocator.template Allocate<MachineMemOperand *>(NewMemRefs.size());
7188-
std::copy(NewMemRefs.begin(), NewMemRefs.end(), MemRefsBuffer);
7188+
llvm::copy(NewMemRefs, MemRefsBuffer);
71897189
N->MemRefs = MemRefsBuffer;
71907190
N->NumMemRefs = static_cast<int>(NewMemRefs.size());
71917191
}

llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ DWARFDebugLoc::parseOneLocationList(DWARFDataExtractor Data, unsigned *Offset) {
124124
StringRef str = Data.getData().substr(*Offset, Bytes);
125125
*Offset += Bytes;
126126
E.Loc.reserve(str.size());
127-
std::copy(str.begin(), str.end(), std::back_inserter(E.Loc));
127+
llvm::copy(str, std::back_inserter(E.Loc));
128128
LL.Entries.push_back(std::move(E));
129129
}
130130
}
@@ -189,7 +189,7 @@ DWARFDebugLoclists::parseOneLocationList(DataExtractor Data, unsigned *Offset,
189189
StringRef str = Data.getData().substr(*Offset, Bytes);
190190
*Offset += Bytes;
191191
E.Loc.resize(str.size());
192-
std::copy(str.begin(), str.end(), E.Loc.begin());
192+
llvm::copy(str, E.Loc.begin());
193193
}
194194

195195
LL.Entries.push_back(std::move(E));

llvm/lib/IR/Attributes.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ LLVM_DUMP_METHOD void AttributeSet::dump() const {
639639
AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs)
640640
: AvailableAttrs(0), NumAttrs(Attrs.size()) {
641641
// There's memory after the node where we can store the entries in.
642-
std::copy(Attrs.begin(), Attrs.end(), getTrailingObjects<Attribute>());
642+
llvm::copy(Attrs, getTrailingObjects<Attribute>());
643643

644644
for (const auto I : *this) {
645645
if (!I.isStringAttribute()) {
@@ -809,7 +809,7 @@ AttributeListImpl::AttributeListImpl(LLVMContext &C,
809809
assert(!Sets.empty() && "pointless AttributeListImpl");
810810

811811
// There's memory after the node where we can store the entries in.
812-
std::copy(Sets.begin(), Sets.end(), getTrailingObjects<AttributeSet>());
812+
llvm::copy(Sets, getTrailingObjects<AttributeSet>());
813813

814814
// Initialize AvailableFunctionAttrs summary bitset.
815815
static_assert(Attribute::EndAttrKinds <=

llvm/lib/IR/Constants.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ ConstantAggregate::ConstantAggregate(CompositeType *T, ValueTy VT,
940940
ArrayRef<Constant *> V)
941941
: Constant(T, VT, OperandTraits<ConstantAggregate>::op_end(this) - V.size(),
942942
V.size()) {
943-
std::copy(V.begin(), V.end(), op_begin());
943+
llvm::copy(V, op_begin());
944944

945945
// Check that types match, unless this is an opaque struct.
946946
if (auto *ST = dyn_cast<StructType>(T))

llvm/lib/IR/Instructions.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void CallInst::init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
275275
"Calling a function with a bad signature!");
276276
#endif
277277

278-
std::copy(Args.begin(), Args.end(), op_begin());
278+
llvm::copy(Args, op_begin());
279279

280280
auto It = populateBundleOperandInfos(Bundles, Args.size());
281281
(void)It;
@@ -577,7 +577,7 @@ void InvokeInst::init(FunctionType *FTy, Value *Fn, BasicBlock *IfNormal,
577577
"Invoking a function with a bad signature!");
578578
#endif
579579

580-
std::copy(Args.begin(), Args.end(), op_begin());
580+
llvm::copy(Args, op_begin());
581581

582582
auto It = populateBundleOperandInfos(Bundles, Args.size());
583583
(void)It;
@@ -834,7 +834,7 @@ void CatchSwitchInst::removeHandler(handler_iterator HI) {
834834
void FuncletPadInst::init(Value *ParentPad, ArrayRef<Value *> Args,
835835
const Twine &NameStr) {
836836
assert(getNumOperands() == 1 + Args.size() && "NumOperands not set up?");
837-
std::copy(Args.begin(), Args.end(), op_begin());
837+
llvm::copy(Args, op_begin());
838838
setParentPad(ParentPad);
839839
setName(NameStr);
840840
}
@@ -1390,7 +1390,7 @@ void GetElementPtrInst::init(Value *Ptr, ArrayRef<Value *> IdxList,
13901390
assert(getNumOperands() == 1 + IdxList.size() &&
13911391
"NumOperands not initialized?");
13921392
Op<0>() = Ptr;
1393-
std::copy(IdxList.begin(), IdxList.end(), op_begin() + 1);
1393+
llvm::copy(IdxList, op_begin() + 1);
13941394
setName(Name);
13951395
}
13961396

llvm/lib/IR/Metadata.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ void GlobalObject::copyMetadata(const GlobalObject *Other, unsigned Offset) {
14841484
std::vector<uint64_t> Elements(OrigElements.size() + 2);
14851485
Elements[0] = dwarf::DW_OP_plus_uconst;
14861486
Elements[1] = Offset;
1487-
std::copy(OrigElements.begin(), OrigElements.end(), Elements.begin() + 2);
1487+
llvm::copy(OrigElements, Elements.begin() + 2);
14881488
E = DIExpression::get(getContext(), Elements);
14891489
Attachment = DIGlobalVariableExpression::get(getContext(), GV, E);
14901490
}

llvm/lib/Object/Object.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI) {
229229
SmallVector<char, 0> ret;
230230
(*unwrap(RI))->getTypeName(ret);
231231
char *str = static_cast<char*>(safe_malloc(ret.size()));
232-
std::copy(ret.begin(), ret.end(), str);
232+
llvm::copy(ret, str);
233233
return str;
234234
}
235235

llvm/lib/Object/WindowsResource.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ WindowsResourceParser::TreeNode::addChild(ArrayRef<UTF16> NameRef,
259259
std::vector<UTF16> EndianCorrectedName;
260260
if (sys::IsBigEndianHost) {
261261
EndianCorrectedName.resize(NameRef.size() + 1);
262-
std::copy(NameRef.begin(), NameRef.end(), EndianCorrectedName.begin() + 1);
262+
llvm::copy(NameRef, EndianCorrectedName.begin() + 1);
263263
EndianCorrectedName[0] = UNI_UTF16_BYTE_ORDER_MARK_SWAPPED;
264264
CorrectedName = makeArrayRef(EndianCorrectedName);
265265
} else
@@ -501,8 +501,7 @@ void WindowsResourceCOFFWriter::writeFirstSection() {
501501
void WindowsResourceCOFFWriter::writeSecondSection() {
502502
// Now write the .rsrc$02 section.
503503
for (auto const &RawDataEntry : Data) {
504-
std::copy(RawDataEntry.begin(), RawDataEntry.end(),
505-
BufferStart + CurrentOffset);
504+
llvm::copy(RawDataEntry, BufferStart + CurrentOffset);
506505
CurrentOffset += alignTo(RawDataEntry.size(), sizeof(uint64_t));
507506
}
508507

@@ -672,7 +671,7 @@ void WindowsResourceCOFFWriter::writeDirectoryStringTable() {
672671
support::endian::write16le(BufferStart + CurrentOffset, Length);
673672
CurrentOffset += sizeof(uint16_t);
674673
auto *Start = reinterpret_cast<UTF16 *>(BufferStart + CurrentOffset);
675-
std::copy(String.begin(), String.end(), Start);
674+
llvm::copy(String, Start);
676675
CurrentOffset += Length * sizeof(UTF16);
677676
TotalStringTableSize += Length * sizeof(UTF16) + sizeof(uint16_t);
678677
}

llvm/lib/Support/Path.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ void replace_path_prefix(SmallVectorImpl<char> &Path,
533533

534534
// If prefixes have the same size we can simply copy the new one over.
535535
if (OldPrefix.size() == NewPrefix.size()) {
536-
std::copy(NewPrefix.begin(), NewPrefix.end(), Path.begin());
536+
llvm::copy(NewPrefix, Path.begin());
537537
return;
538538
}
539539

llvm/lib/Support/RandomNumberGenerator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ RandomNumberGenerator::RandomNumberGenerator(StringRef Salt) {
4949
Data[0] = Seed;
5050
Data[1] = Seed >> 32;
5151

52-
std::copy(Salt.begin(), Salt.end(), Data.begin() + 2);
52+
llvm::copy(Salt, Data.begin() + 2);
5353

5454
std::seed_seq SeedSeq(Data.begin(), Data.end());
5555
Generator.seed(SeedSeq);

llvm/lib/Target/X86/X86ISelLowering.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -37351,7 +37351,7 @@ static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool IsCommutative) {
3735137351
if (!LHS.getOperand(1).isUndef())
3735237352
B = LHS.getOperand(1);
3735337353
ArrayRef<int> Mask = cast<ShuffleVectorSDNode>(LHS.getNode())->getMask();
37354-
std::copy(Mask.begin(), Mask.end(), LMask.begin());
37354+
llvm::copy(Mask, LMask.begin());
3735537355
} else {
3735637356
A = LHS;
3735737357
for (unsigned i = 0; i != NumElts; ++i)
@@ -37368,7 +37368,7 @@ static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool IsCommutative) {
3736837368
if (!RHS.getOperand(1).isUndef())
3736937369
D = RHS.getOperand(1);
3737037370
ArrayRef<int> Mask = cast<ShuffleVectorSDNode>(RHS.getNode())->getMask();
37371-
std::copy(Mask.begin(), Mask.end(), RMask.begin());
37371+
llvm::copy(Mask, RMask.begin());
3737237372
} else {
3737337373
C = RHS;
3737437374
for (unsigned i = 0; i != NumElts; ++i)

llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ bool CHRScopeSorter(CHRScope *Scope1, CHRScope *Scope2) {
14161416
void CHR::sortScopes(SmallVectorImpl<CHRScope *> &Input,
14171417
SmallVectorImpl<CHRScope *> &Output) {
14181418
Output.resize(Input.size());
1419-
std::copy(Input.begin(), Input.end(), Output.begin());
1419+
llvm::copy(Input, Output.begin());
14201420
std::stable_sort(Output.begin(), Output.end(), CHRScopeSorter);
14211421
}
14221422

llvm/lib/Transforms/Scalar/GVNSink.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ class ModelledPHI {
258258
/// Create a PHI from an array of incoming values and incoming blocks.
259259
template <typename VArray, typename BArray>
260260
ModelledPHI(const VArray &V, const BArray &B) {
261-
std::copy(V.begin(), V.end(), std::back_inserter(Values));
262-
std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
261+
llvm::copy(V, std::back_inserter(Values));
262+
llvm::copy(B, std::back_inserter(Blocks));
263263
}
264264

265265
/// Create a PHI from [I[OpNum] for I in Insts].
266266
template <typename BArray>
267267
ModelledPHI(ArrayRef<Instruction *> Insts, unsigned OpNum, const BArray &B) {
268-
std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
268+
llvm::copy(B, std::back_inserter(Blocks));
269269
for (auto *I : Insts)
270270
Values.push_back(I->getOperand(OpNum));
271271
}

llvm/lib/Transforms/Scalar/NewGVN.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -3175,8 +3175,7 @@ bool NewGVN::singleReachablePHIPath(
31753175
auto FilteredPhiArgs =
31763176
make_filter_range(MP->operands(), ReachableOperandPred);
31773177
SmallVector<const Value *, 32> OperandList;
3178-
std::copy(FilteredPhiArgs.begin(), FilteredPhiArgs.end(),
3179-
std::back_inserter(OperandList));
3178+
llvm::copy(FilteredPhiArgs, std::back_inserter(OperandList));
31803179
bool Okay = is_splat(OperandList);
31813180
if (Okay)
31823181
return singleReachablePHIPath(Visited, cast<MemoryAccess>(OperandList[0]),

llvm/tools/llvm-objcopy/ELF/Object.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ void SectionWriter::visit(const Section &Sec) {
9797
if (Sec.Type == SHT_NOBITS)
9898
return;
9999
uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
100-
std::copy(std::begin(Sec.Contents), std::end(Sec.Contents), Buf);
100+
llvm::copy(Sec.Contents, Buf);
101101
}
102102

103103
void Section::accept(SectionVisitor &Visitor) const { Visitor.visit(*this); }
104104

105105
void SectionWriter::visit(const OwnedDataSection &Sec) {
106106
uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
107-
std::copy(std::begin(Sec.Data), std::end(Sec.Data), Buf);
107+
llvm::copy(Sec.Data, Buf);
108108
}
109109

110110
static const std::vector<uint8_t> ZlibGnuMagic = {'Z', 'L', 'I', 'B'};
@@ -269,7 +269,7 @@ template <class ELFT>
269269
void ELFSectionWriter<ELFT>::visit(const SectionIndexSection &Sec) {
270270
uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
271271
auto *IndexesBuffer = reinterpret_cast<Elf_Word *>(Buf);
272-
std::copy(std::begin(Sec.Indexes), std::end(Sec.Indexes), IndexesBuffer);
272+
llvm::copy(Sec.Indexes, IndexesBuffer);
273273
}
274274

275275
void SectionIndexSection::initialize(SectionTableRef SecTable) {
@@ -554,7 +554,7 @@ void RelocationSection::markSymbols() {
554554
}
555555

556556
void SectionWriter::visit(const DynamicRelocationSection &Sec) {
557-
std::copy(std::begin(Sec.Contents), std::end(Sec.Contents),
557+
llvm::copy(Sec.Contents,
558558
Out.getBufferStart() + Sec.Offset);
559559
}
560560

@@ -641,7 +641,7 @@ void ELFSectionWriter<ELFT>::visit(const GnuDebugLinkSection &Sec) {
641641
Elf_Word *CRC =
642642
reinterpret_cast<Elf_Word *>(Buf + Sec.Size - sizeof(Elf_Word));
643643
*CRC = Sec.CRC32;
644-
std::copy(std::begin(Sec.FileName), std::end(Sec.FileName), File);
644+
llvm::copy(Sec.FileName, File);
645645
}
646646

647647
void GnuDebugLinkSection::accept(SectionVisitor &Visitor) const {

0 commit comments

Comments
 (0)