Skip to content

[llvm] Use llvm::copy (NFC) #137470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3935,7 +3935,7 @@ DwarfDebug::getMD5AsBytes(const DIFile *File) const {
// An MD5 checksum is 16 bytes.
std::string ChecksumString = fromHex(Checksum->Value);
MD5::MD5Result CKMem;
std::copy(ChecksumString.begin(), ChecksumString.end(), CKMem.data());
llvm::copy(ChecksumString, CKMem.data());
return CKMem;
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ mergeVectorRegsToResultRegs(MachineIRBuilder &B, ArrayRef<Register> DstRegs,
int NumDst = LCMTy.getSizeInBits() / LLTy.getSizeInBits();

SmallVector<Register, 8> PadDstRegs(NumDst);
std::copy(DstRegs.begin(), DstRegs.end(), PadDstRegs.begin());
llvm::copy(DstRegs, PadDstRegs.begin());

// Create the excess dead defs for the unmerge.
for (int I = DstRegs.size(); I != NumDst; ++I)
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/LiveDebugVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class DbgVariableValue {
LocNoCount = LocNoVec.size();
if (LocNoCount > 0) {
LocNos = std::make_unique<unsigned[]>(LocNoCount);
std::copy(LocNoVec.begin(), LocNoVec.end(), loc_nos_begin());
llvm::copy(LocNoVec, loc_nos_begin());
}
} else {
LLVM_DEBUG(dbgs() << "Found debug value with 64+ unique machine "
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ class SDDbgValue {
IsVariadic(IsVariadic) {
assert(IsVariadic || L.size() == 1);
assert(!(IsVariadic && IsIndirect));
std::copy(L.begin(), L.end(), LocationOps);
std::copy(Dependencies.begin(), Dependencies.end(), AdditionalDependencies);
llvm::copy(L, LocationOps);
llvm::copy(Dependencies, AdditionalDependencies);
}

// We allocate arrays with the BumpPtrAllocator and never free or copy them,
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void *ArgvArray::reset(LLVMContext &C, ExecutionEngine *EE,
LLVM_DEBUG(dbgs() << "JIT: ARGV[" << i << "] = " << (void *)Dest.get()
<< "\n");

std::copy(InputArgv[i].begin(), InputArgv[i].end(), Dest.get());
llvm::copy(InputArgv[i], Dest.get());
Dest[Size-1] = 0;

// Endian safe: Array[i] = (PointerTy)Dest;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/Instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ void CallBrInst::init(FunctionType *FTy, Value *Fn, BasicBlock *Fallthrough,

// Set operands in order of their index to match use-list-order
// prediction.
std::copy(Args.begin(), Args.end(), op_begin());
llvm::copy(Args, op_begin());
NumIndirectDests = IndirectDests.size();
setDefaultDest(Fallthrough);
for (unsigned i = 0; i != NumIndirectDests; ++i)
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/ObjCopy/COFF/COFFWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void COFFWriter::writeSections() {
uint8_t *Ptr = reinterpret_cast<uint8_t *>(Buf->getBufferStart()) +
S.Header.PointerToRawData;
ArrayRef<uint8_t> Contents = S.getContents();
std::copy(Contents.begin(), Contents.end(), Ptr);
llvm::copy(Contents, Ptr);

// For executable sections, pad the remainder of the raw data size with
// 0xcc, which is int3 on x86.
Expand Down Expand Up @@ -355,7 +355,7 @@ template <class SymbolTy> void COFFWriter::writeSymbolStringTables() {
// For file symbols, just write the string into the aux symbol slots,
// assuming that the unwritten parts are initialized to zero in the memory
// mapped file.
std::copy(S.AuxFile.begin(), S.AuxFile.end(), Ptr);
llvm::copy(S.AuxFile, Ptr);
Ptr += S.Sym.NumberOfAuxSymbols * sizeof(SymbolTy);
} else {
// For other auxillary symbols, write their opaque payload into one symbol
Expand All @@ -364,7 +364,7 @@ template <class SymbolTy> void COFFWriter::writeSymbolStringTables() {
// entry.
for (const AuxSymbol &AuxSym : S.AuxData) {
ArrayRef<uint8_t> Ref = AuxSym.getRef();
std::copy(Ref.begin(), Ref.end(), Ptr);
llvm::copy(Ref, Ptr);
Ptr += sizeof(SymbolTy);
}
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ObjCopy/ELF/ELFObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ Error ELFSectionWriter<ELFT>::visit(const DecompressedSection &Sec) {
"': " + toString(std::move(E)));

uint8_t *Buf = reinterpret_cast<uint8_t *>(Out.getBufferStart()) + Sec.Offset;
std::copy(Decompressed.begin(), Decompressed.end(), Buf);
llvm::copy(Decompressed, Buf);

return Error::success();
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void updateLoadCommandPayloadString(LoadCommand &LC, StringRef S) {

LC.MachOLoadCommand.load_command_data.cmdsize = NewCmdsize;
LC.Payload.assign(NewCmdsize - sizeof(LCType), 0);
std::copy(S.begin(), S.end(), LC.Payload.begin());
llvm::copy(S, LC.Payload.begin());
}

static LoadCommand buildRPathLoadCommand(StringRef Path) {
Expand All @@ -172,7 +172,7 @@ static LoadCommand buildRPathLoadCommand(StringRef Path) {
RPathLC.cmdsize = alignTo(sizeof(MachO::rpath_command) + Path.size() + 1, 8);
LC.MachOLoadCommand.rpath_command_data = RPathLC;
LC.Payload.assign(RPathLC.cmdsize - sizeof(MachO::rpath_command), 0);
std::copy(Path.begin(), Path.end(), LC.Payload.begin());
llvm::copy(Path, LC.Payload.begin());
return LC;
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ObjCopy/XCOFF/XCOFFWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void XCOFFWriter::writeSections() {
for (const Section &Sec : Obj.Sections) {
uint8_t *Ptr = reinterpret_cast<uint8_t *>(Buf->getBufferStart()) +
Sec.SectionHeader.FileOffsetToRawData;
Ptr = std::copy(Sec.Contents.begin(), Sec.Contents.end(), Ptr);
Ptr = llvm::copy(Sec.Contents, Ptr);
}

// Write relocations.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static Error dumpSectionToFile(StringRef SecName, StringRef Filename,
if (!BufferOrErr)
return createFileError(Filename, BufferOrErr.takeError());
std::unique_ptr<FileOutputBuffer> Buf = std::move(*BufferOrErr);
std::copy(Contents.begin(), Contents.end(), Buf->getBufferStart());
llvm::copy(Contents, Buf->getBufferStart());
if (Error E = Buf->commit())
return createFileError(Filename, std::move(E));
return Error::success();
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ObjectYAML/COFFEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct COFFParser {
StringRef Name = Sec.Name;

if (Name.size() <= COFF::NameSize) {
std::copy(Name.begin(), Name.end(), Sec.Header.Name);
llvm::copy(Name, Sec.Header.Name);
} else {
// Add string to the string table and format the index for output.
unsigned Index = getStringIndex(Name);
Expand All @@ -75,7 +75,7 @@ struct COFFParser {
return false;
}
Sec.Header.Name[0] = '/';
std::copy(str.begin(), str.end(), Sec.Header.Name + 1);
llvm::copy(str, Sec.Header.Name + 1);
}

if (Sec.Alignment) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,11 +1269,11 @@ OpRef HvxSelector::packs(ShuffleMask SM, OpRef Va, OpRef Vb,
return OpRef::fail();

if (Vb.isUndef()) {
std::copy(SM.Mask.begin(), SM.Mask.end(), NewMask.begin());
llvm::copy(SM.Mask, NewMask.begin());
return Va;
}
if (Va.isUndef()) {
std::copy(SM.Mask.begin(), SM.Mask.end(), NewMask.begin());
llvm::copy(SM.Mask, NewMask.begin());
ShuffleVectorSDNode::commuteMask(NewMask);
return Vb;
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/NewGVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,14 +1267,14 @@ NewGVN::createAggregateValueExpression(Instruction *I) const {
AggregateValueExpression(I->getNumOperands(), II->getNumIndices());
setBasicExpressionInfo(I, E);
E->allocateIntOperands(ExpressionAllocator);
std::copy(II->idx_begin(), II->idx_end(), int_op_inserter(E));
llvm::copy(II->indices(), int_op_inserter(E));
return E;
} else if (auto *EI = dyn_cast<ExtractValueInst>(I)) {
auto *E = new (ExpressionAllocator)
AggregateValueExpression(I->getNumOperands(), EI->getNumIndices());
setBasicExpressionInfo(EI, E);
E->allocateIntOperands(ExpressionAllocator);
std::copy(EI->idx_begin(), EI->idx_end(), int_op_inserter(E));
llvm::copy(EI->indices(), int_op_inserter(E));
return E;
}
llvm_unreachable("Unhandled type of aggregate value operation");
Expand Down
Loading