1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

Use llvm::copy. NFC

llvm-svn: 347126
This commit is contained in:
Fangrui Song 2018-11-17 01:44:25 +00:00
parent 8d22f81dc4
commit cb3e0aa543
22 changed files with 38 additions and 42 deletions

View File

@ -420,7 +420,7 @@ void RuntimePointerChecking::groupChecks(
// We've computed the grouped checks for this partition.
// Save the results and continue with the next one.
std::copy(Groups.begin(), Groups.end(), std::back_inserter(CheckingGroups));
llvm::copy(Groups, std::back_inserter(CheckingGroups));
}
}

View File

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

View File

@ -4026,7 +4026,7 @@ void ModuleBitcodeWriter::writeModuleHash(size_t BlockStartPos) {
if (ModHash)
// Save the written hash value.
std::copy(std::begin(Vals), std::end(Vals), std::begin(*ModHash));
llvm::copy(Vals, std::begin(*ModHash));
}
}

View File

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

View File

@ -677,8 +677,7 @@ static bool runOnBasicBlock(MachineBasicBlock *MBB,
std::vector<MachineInstr *> Candidates = populateCandidates(MBB);
std::vector<MachineInstr *> VisitedMIs;
std::copy(Candidates.begin(), Candidates.end(),
std::back_inserter(VisitedMIs));
llvm::copy(Candidates, std::back_inserter(VisitedMIs));
std::vector<TypedVReg> VRegs;
for (auto candidate : Candidates) {

View File

@ -435,7 +435,7 @@ MachineFunction::createMIExtraInfo(ArrayRef<MachineMemOperand *> MMOs,
const char *MachineFunction::createExternalSymbolName(StringRef Name) {
char *Dest = Allocator.Allocate<char>(Name.size() + 1);
std::copy(Name.begin(), Name.end(), Dest);
llvm::copy(Name, Dest);
Dest[Name.size()] = 0;
return Dest;
}

View File

@ -218,8 +218,7 @@ computeHeightResources(const MachineBasicBlock *MBB) {
// The trace tail is done.
if (!TBI->Succ) {
TBI->Tail = MBB->getNumber();
std::copy(PRCycles.begin(), PRCycles.end(),
ProcResourceHeights.begin() + PROffset);
llvm::copy(PRCycles, ProcResourceHeights.begin() + PROffset);
return;
}

View File

@ -1685,7 +1685,7 @@ SDValue SelectionDAG::getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1,
// SDNode doesn't have access to it. This memory will be "leaked" when
// the node is deallocated, but recovered when the NodeAllocator is released.
int *MaskAlloc = OperandAllocator.Allocate<int>(NElts);
std::copy(MaskVec.begin(), MaskVec.end(), MaskAlloc);
llvm::copy(MaskVec, MaskAlloc);
auto *N = newSDNode<ShuffleVectorSDNode>(VT, dl.getIROrder(),
dl.getDebugLoc(), MaskAlloc);
@ -7039,7 +7039,7 @@ SDVTList SelectionDAG::getVTList(ArrayRef<EVT> VTs) {
SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
if (!Result) {
EVT *Array = Allocator.Allocate<EVT>(NumVTs);
std::copy(VTs.begin(), VTs.end(), Array);
llvm::copy(VTs, Array);
Result = new (Allocator) SDVTListNode(ID.Intern(Allocator), Array, NumVTs);
VTListMap.InsertNode(Result, IP);
}
@ -7185,7 +7185,7 @@ void SelectionDAG::setNodeMemRefs(MachineSDNode *N,
MachineMemOperand **MemRefsBuffer =
Allocator.template Allocate<MachineMemOperand *>(NewMemRefs.size());
std::copy(NewMemRefs.begin(), NewMemRefs.end(), MemRefsBuffer);
llvm::copy(NewMemRefs, MemRefsBuffer);
N->MemRefs = MemRefsBuffer;
N->NumMemRefs = static_cast<int>(NewMemRefs.size());
}

View File

@ -124,7 +124,7 @@ DWARFDebugLoc::parseOneLocationList(DWARFDataExtractor Data, unsigned *Offset) {
StringRef str = Data.getData().substr(*Offset, Bytes);
*Offset += Bytes;
E.Loc.reserve(str.size());
std::copy(str.begin(), str.end(), std::back_inserter(E.Loc));
llvm::copy(str, std::back_inserter(E.Loc));
LL.Entries.push_back(std::move(E));
}
}
@ -189,7 +189,7 @@ DWARFDebugLoclists::parseOneLocationList(DataExtractor Data, unsigned *Offset,
StringRef str = Data.getData().substr(*Offset, Bytes);
*Offset += Bytes;
E.Loc.resize(str.size());
std::copy(str.begin(), str.end(), E.Loc.begin());
llvm::copy(str, E.Loc.begin());
}
LL.Entries.push_back(std::move(E));

View File

@ -639,7 +639,7 @@ LLVM_DUMP_METHOD void AttributeSet::dump() const {
AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs)
: AvailableAttrs(0), NumAttrs(Attrs.size()) {
// There's memory after the node where we can store the entries in.
std::copy(Attrs.begin(), Attrs.end(), getTrailingObjects<Attribute>());
llvm::copy(Attrs, getTrailingObjects<Attribute>());
for (const auto I : *this) {
if (!I.isStringAttribute()) {
@ -809,7 +809,7 @@ AttributeListImpl::AttributeListImpl(LLVMContext &C,
assert(!Sets.empty() && "pointless AttributeListImpl");
// There's memory after the node where we can store the entries in.
std::copy(Sets.begin(), Sets.end(), getTrailingObjects<AttributeSet>());
llvm::copy(Sets, getTrailingObjects<AttributeSet>());
// Initialize AvailableFunctionAttrs summary bitset.
static_assert(Attribute::EndAttrKinds <=

View File

@ -940,7 +940,7 @@ ConstantAggregate::ConstantAggregate(CompositeType *T, ValueTy VT,
ArrayRef<Constant *> V)
: Constant(T, VT, OperandTraits<ConstantAggregate>::op_end(this) - V.size(),
V.size()) {
std::copy(V.begin(), V.end(), op_begin());
llvm::copy(V, op_begin());
// Check that types match, unless this is an opaque struct.
if (auto *ST = dyn_cast<StructType>(T))

View File

@ -275,7 +275,7 @@ void CallInst::init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
"Calling a function with a bad signature!");
#endif
std::copy(Args.begin(), Args.end(), op_begin());
llvm::copy(Args, op_begin());
auto It = populateBundleOperandInfos(Bundles, Args.size());
(void)It;
@ -577,7 +577,7 @@ void InvokeInst::init(FunctionType *FTy, Value *Fn, BasicBlock *IfNormal,
"Invoking a function with a bad signature!");
#endif
std::copy(Args.begin(), Args.end(), op_begin());
llvm::copy(Args, op_begin());
auto It = populateBundleOperandInfos(Bundles, Args.size());
(void)It;
@ -834,7 +834,7 @@ void CatchSwitchInst::removeHandler(handler_iterator HI) {
void FuncletPadInst::init(Value *ParentPad, ArrayRef<Value *> Args,
const Twine &NameStr) {
assert(getNumOperands() == 1 + Args.size() && "NumOperands not set up?");
std::copy(Args.begin(), Args.end(), op_begin());
llvm::copy(Args, op_begin());
setParentPad(ParentPad);
setName(NameStr);
}
@ -1390,7 +1390,7 @@ void GetElementPtrInst::init(Value *Ptr, ArrayRef<Value *> IdxList,
assert(getNumOperands() == 1 + IdxList.size() &&
"NumOperands not initialized?");
Op<0>() = Ptr;
std::copy(IdxList.begin(), IdxList.end(), op_begin() + 1);
llvm::copy(IdxList, op_begin() + 1);
setName(Name);
}

View File

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

View File

@ -229,7 +229,7 @@ const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI) {
SmallVector<char, 0> ret;
(*unwrap(RI))->getTypeName(ret);
char *str = static_cast<char*>(safe_malloc(ret.size()));
std::copy(ret.begin(), ret.end(), str);
llvm::copy(ret, str);
return str;
}

View File

@ -259,7 +259,7 @@ WindowsResourceParser::TreeNode::addChild(ArrayRef<UTF16> NameRef,
std::vector<UTF16> EndianCorrectedName;
if (sys::IsBigEndianHost) {
EndianCorrectedName.resize(NameRef.size() + 1);
std::copy(NameRef.begin(), NameRef.end(), EndianCorrectedName.begin() + 1);
llvm::copy(NameRef, EndianCorrectedName.begin() + 1);
EndianCorrectedName[0] = UNI_UTF16_BYTE_ORDER_MARK_SWAPPED;
CorrectedName = makeArrayRef(EndianCorrectedName);
} else
@ -501,8 +501,7 @@ void WindowsResourceCOFFWriter::writeFirstSection() {
void WindowsResourceCOFFWriter::writeSecondSection() {
// Now write the .rsrc$02 section.
for (auto const &RawDataEntry : Data) {
std::copy(RawDataEntry.begin(), RawDataEntry.end(),
BufferStart + CurrentOffset);
llvm::copy(RawDataEntry, BufferStart + CurrentOffset);
CurrentOffset += alignTo(RawDataEntry.size(), sizeof(uint64_t));
}
@ -672,7 +671,7 @@ void WindowsResourceCOFFWriter::writeDirectoryStringTable() {
support::endian::write16le(BufferStart + CurrentOffset, Length);
CurrentOffset += sizeof(uint16_t);
auto *Start = reinterpret_cast<UTF16 *>(BufferStart + CurrentOffset);
std::copy(String.begin(), String.end(), Start);
llvm::copy(String, Start);
CurrentOffset += Length * sizeof(UTF16);
TotalStringTableSize += Length * sizeof(UTF16) + sizeof(uint16_t);
}

View File

@ -533,7 +533,7 @@ void replace_path_prefix(SmallVectorImpl<char> &Path,
// If prefixes have the same size we can simply copy the new one over.
if (OldPrefix.size() == NewPrefix.size()) {
std::copy(NewPrefix.begin(), NewPrefix.end(), Path.begin());
llvm::copy(NewPrefix, Path.begin());
return;
}

View File

@ -49,7 +49,7 @@ RandomNumberGenerator::RandomNumberGenerator(StringRef Salt) {
Data[0] = Seed;
Data[1] = Seed >> 32;
std::copy(Salt.begin(), Salt.end(), Data.begin() + 2);
llvm::copy(Salt, Data.begin() + 2);
std::seed_seq SeedSeq(Data.begin(), Data.end());
Generator.seed(SeedSeq);

View File

@ -37351,7 +37351,7 @@ static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool IsCommutative) {
if (!LHS.getOperand(1).isUndef())
B = LHS.getOperand(1);
ArrayRef<int> Mask = cast<ShuffleVectorSDNode>(LHS.getNode())->getMask();
std::copy(Mask.begin(), Mask.end(), LMask.begin());
llvm::copy(Mask, LMask.begin());
} else {
A = LHS;
for (unsigned i = 0; i != NumElts; ++i)
@ -37368,7 +37368,7 @@ static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool IsCommutative) {
if (!RHS.getOperand(1).isUndef())
D = RHS.getOperand(1);
ArrayRef<int> Mask = cast<ShuffleVectorSDNode>(RHS.getNode())->getMask();
std::copy(Mask.begin(), Mask.end(), RMask.begin());
llvm::copy(Mask, RMask.begin());
} else {
C = RHS;
for (unsigned i = 0; i != NumElts; ++i)

View File

@ -1416,7 +1416,7 @@ bool CHRScopeSorter(CHRScope *Scope1, CHRScope *Scope2) {
void CHR::sortScopes(SmallVectorImpl<CHRScope *> &Input,
SmallVectorImpl<CHRScope *> &Output) {
Output.resize(Input.size());
std::copy(Input.begin(), Input.end(), Output.begin());
llvm::copy(Input, Output.begin());
std::stable_sort(Output.begin(), Output.end(), CHRScopeSorter);
}

View File

@ -258,14 +258,14 @@ public:
/// Create a PHI from an array of incoming values and incoming blocks.
template <typename VArray, typename BArray>
ModelledPHI(const VArray &V, const BArray &B) {
std::copy(V.begin(), V.end(), std::back_inserter(Values));
std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
llvm::copy(V, std::back_inserter(Values));
llvm::copy(B, std::back_inserter(Blocks));
}
/// Create a PHI from [I[OpNum] for I in Insts].
template <typename BArray>
ModelledPHI(ArrayRef<Instruction *> Insts, unsigned OpNum, const BArray &B) {
std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
llvm::copy(B, std::back_inserter(Blocks));
for (auto *I : Insts)
Values.push_back(I->getOperand(OpNum));
}

View File

@ -3175,8 +3175,7 @@ bool NewGVN::singleReachablePHIPath(
auto FilteredPhiArgs =
make_filter_range(MP->operands(), ReachableOperandPred);
SmallVector<const Value *, 32> OperandList;
std::copy(FilteredPhiArgs.begin(), FilteredPhiArgs.end(),
std::back_inserter(OperandList));
llvm::copy(FilteredPhiArgs, std::back_inserter(OperandList));
bool Okay = is_splat(OperandList);
if (Okay)
return singleReachablePHIPath(Visited, cast<MemoryAccess>(OperandList[0]),

View File

@ -97,14 +97,14 @@ void SectionWriter::visit(const Section &Sec) {
if (Sec.Type == SHT_NOBITS)
return;
uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
std::copy(std::begin(Sec.Contents), std::end(Sec.Contents), Buf);
llvm::copy(Sec.Contents, Buf);
}
void Section::accept(SectionVisitor &Visitor) const { Visitor.visit(*this); }
void SectionWriter::visit(const OwnedDataSection &Sec) {
uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
std::copy(std::begin(Sec.Data), std::end(Sec.Data), Buf);
llvm::copy(Sec.Data, Buf);
}
static const std::vector<uint8_t> ZlibGnuMagic = {'Z', 'L', 'I', 'B'};
@ -269,7 +269,7 @@ template <class ELFT>
void ELFSectionWriter<ELFT>::visit(const SectionIndexSection &Sec) {
uint8_t *Buf = Out.getBufferStart() + Sec.Offset;
auto *IndexesBuffer = reinterpret_cast<Elf_Word *>(Buf);
std::copy(std::begin(Sec.Indexes), std::end(Sec.Indexes), IndexesBuffer);
llvm::copy(Sec.Indexes, IndexesBuffer);
}
void SectionIndexSection::initialize(SectionTableRef SecTable) {
@ -554,7 +554,7 @@ void RelocationSection::markSymbols() {
}
void SectionWriter::visit(const DynamicRelocationSection &Sec) {
std::copy(std::begin(Sec.Contents), std::end(Sec.Contents),
llvm::copy(Sec.Contents,
Out.getBufferStart() + Sec.Offset);
}
@ -641,7 +641,7 @@ void ELFSectionWriter<ELFT>::visit(const GnuDebugLinkSection &Sec) {
Elf_Word *CRC =
reinterpret_cast<Elf_Word *>(Buf + Sec.Size - sizeof(Elf_Word));
*CRC = Sec.CRC32;
std::copy(std::begin(Sec.FileName), std::end(Sec.FileName), File);
llvm::copy(Sec.FileName, File);
}
void GnuDebugLinkSection::accept(SectionVisitor &Visitor) const {