Skip to content

[llvm] Use llvm::append_range (NFC) #135931

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
6 changes: 4 additions & 2 deletions llvm/include/llvm/IR/ModuleSummaryIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,10 @@ class CfiFunctionIndex {

std::vector<StringRef> symbols() const {
std::vector<StringRef> Symbols;
for (auto &[GUID, Syms] : Index)
Symbols.insert(Symbols.end(), Syms.begin(), Syms.end());
for (auto &[GUID, Syms] : Index) {
(void)GUID;
llvm::append_range(Symbols, Syms);
}
return Symbols;
}

Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Analysis/MemoryProfileInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ void CallStackTrie::addCallStack(
Curr = New;
}
assert(Curr);
Curr->ContextSizeInfo.insert(Curr->ContextSizeInfo.end(),
ContextSizeInfo.begin(), ContextSizeInfo.end());
llvm::append_range(Curr->ContextSizeInfo, ContextSizeInfo);
}

void CallStackTrie::addCallStack(MDNode *MIB) {
Expand Down Expand Up @@ -235,8 +234,7 @@ static MDNode *createMIBNode(LLVMContext &Ctx, ArrayRef<uint64_t> MIBCallStack,

void CallStackTrie::collectContextSizeInfo(
CallStackTrieNode *Node, std::vector<ContextTotalSize> &ContextSizeInfo) {
ContextSizeInfo.insert(ContextSizeInfo.end(), Node->ContextSizeInfo.begin(),
Node->ContextSizeInfo.end());
llvm::append_range(ContextSizeInfo, Node->ContextSizeInfo);
for (auto &Caller : Node->Callers)
collectContextSizeInfo(Caller.second, ContextSizeInfo);
}
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Analysis/ScalarEvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8503,10 +8503,8 @@ void ScalarEvolution::forgetLoop(const Loop *L) {
}

auto LoopUsersItr = LoopUsers.find(CurrL);
if (LoopUsersItr != LoopUsers.end()) {
ToForget.insert(ToForget.end(), LoopUsersItr->second.begin(),
LoopUsersItr->second.end());
}
if (LoopUsersItr != LoopUsers.end())
llvm::append_range(ToForget, LoopUsersItr->second);

// Drop information about expressions based on loop-header PHIs.
PushLoopPHIs(CurrL, Worklist, Visited);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5098,7 +5098,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
return;
for (GlobalValue::GUID GUID : DefOrUseGUIDs) {
auto Defs = CfiIndex.forGuid(GUID);
Functions.insert(Functions.end(), Defs.begin(), Defs.end());
llvm::append_range(Functions, Defs);
}
if (Functions.empty())
return;
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,7 @@ void DwarfTransformer::parseCallSiteInfoFromDwarf(CUInfo &CUI, DWARFDie Die,
if (!FI.CallSites)
FI.CallSites = CallSiteInfoCollection();
// Append parsed DWARF callsites:
FI.CallSites->CallSites.insert(FI.CallSites->CallSites.end(),
CSIC.CallSites.begin(),
CSIC.CallSites.end());
llvm::append_range(FI.CallSites->CallSites, CSIC.CallSites);
}
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/LogicalView/Core/LVCompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Error LVCompare::execute(LVReader *ReferenceReader, LVReader *TargetReader) {
}
if (Pass == LVComparePass::Added)
// Record all the current missing elements for this category.
Set.insert(Set.end(), Elements.begin(), Elements.end());
llvm::append_range(Set, Elements);
if (options().getReportList()) {
if (Elements.size()) {
OS << "\n(" << Elements.size() << ") "
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static GenericValue lle_X_fprintf(FunctionType *FT,
char Buffer[10000];
std::vector<GenericValue> NewArgs;
NewArgs.push_back(PTOGV(Buffer));
NewArgs.insert(NewArgs.end(), Args.begin()+1, Args.end());
llvm::append_range(NewArgs, llvm::drop_begin(Args));
GenericValue GV = lle_X_sprintf(FT, NewArgs);

fputs(Buffer, (FILE *) GVTOP(Args[0]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void VTuneSupportPlugin::notifyTransferringResources(JITDylib &JD,
return;

auto &Dest = LoadedMethodIDs[DstKey];
Dest.insert(Dest.end(), I->second.begin(), I->second.end());
llvm::append_range(Dest, I->second);
LoadedMethodIDs.erase(SrcKey);
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void LazyReexportsManager::handleTransferResources(JITDylib &JD,
} else {
auto &SrcAddrs = I->second;
auto &DstAddrs = J->second;
DstAddrs.insert(DstAddrs.end(), SrcAddrs.begin(), SrcAddrs.end());
llvm::append_range(DstAddrs, SrcAddrs);
KeyToReentryAddrs.erase(I);
}
if (L)
Expand Down Expand Up @@ -503,7 +503,7 @@ void SimpleLazyReexportsSpeculator::onLazyReexportsTransfered(
} else {
auto &SrcNames = J->second;
auto &DstNames = K->second;
DstNames.insert(DstNames.end(), SrcNames.begin(), SrcNames.end());
llvm::append_range(DstNames, SrcNames);
MapForJD.erase(J);
}
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/DebugInfoMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ DIExpression *DIExpression::appendOpsToArg(const DIExpression *Expr,
}
Op.appendToVector(NewOps);
if (Op.getOp() == dwarf::DW_OP_LLVM_arg && Op.getArg(0) == ArgNo)
NewOps.insert(NewOps.end(), Ops.begin(), Ops.end());
llvm::append_range(NewOps, Ops);
}
if (StackValue)
NewOps.push_back(dwarf::DW_OP_stack_value);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/MC/DXContainerPSVInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ ProcessElementList(StringTableBuilder &StrTabBuilder,
size_t Idx = FindSequence(IndexBuffer, El.Indices);
if (Idx == npos) {
FinalElement.IndicesOffset = static_cast<uint32_t>(IndexBuffer.size());
IndexBuffer.insert(IndexBuffer.end(), El.Indices.begin(),
El.Indices.end());
llvm::append_range(IndexBuffer, El.Indices);
} else
FinalElement.IndicesOffset = static_cast<uint32_t>(Idx);
FinalElements.push_back(FinalElement);
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/MC/MCParser/MasmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3647,9 +3647,8 @@ bool MasmParser::parseFieldInitializer(const FieldInfo &Field,
std::to_string(Initializers.size()));
}
// Default-initialize all remaining values.
Initializers.insert(Initializers.end(),
Contents.Initializers.begin() + Initializers.size(),
Contents.Initializers.end());
llvm::append_range(Initializers, llvm::drop_begin(Contents.Initializers,
Initializers.size()));

Initializer = FieldInitializer(std::move(Initializers), Contents.Structure);
return false;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,13 +662,13 @@ RemoveNoteDetail::updateData(ArrayRef<uint8_t> OldData,
for (const DeletedRange &RemRange : ToRemove) {
if (CurPos < RemRange.OldFrom) {
auto Slice = OldData.slice(CurPos, RemRange.OldFrom - CurPos);
NewData.insert(NewData.end(), Slice.begin(), Slice.end());
llvm::append_range(NewData, Slice);
}
CurPos = RemRange.OldTo;
}
if (CurPos < OldData.size()) {
auto Slice = OldData.slice(CurPos);
NewData.insert(NewData.end(), Slice.begin(), Slice.end());
llvm::append_range(NewData, Slice);
}
return NewData;
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ProfileData/InstrProfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ class llvm::InstrProfReaderItaniumRemapper
SmallVectorImpl<char> &Out) {
Out.reserve(OrigName.size() + Replacement.size() - ExtractedName.size());
Out.insert(Out.end(), OrigName.begin(), ExtractedName.begin());
Out.insert(Out.end(), Replacement.begin(), Replacement.end());
llvm::append_range(Out, Replacement);
Out.insert(Out.end(), ExtractedName.end(), OrigName.end());
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/TargetParser/SubtargetFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void SubtargetFeatures::AddFeature(StringRef String, bool Enable) {

void SubtargetFeatures::addFeaturesVector(
const ArrayRef<std::string> OtherFeatures) {
Features.insert(Features.cend(), OtherFeatures.begin(), OtherFeatures.end());
llvm::append_range(Features, OtherFeatures);
}

SubtargetFeatures::SubtargetFeatures(StringRef Initial) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,15 @@ void dwarfgen::LineTable::addByte(uint8_t Value) {
void dwarfgen::LineTable::addStandardOpcode(uint8_t Opcode,
ArrayRef<ValueAndLength> Operands) {
Contents.push_back({Opcode, Byte});
Contents.insert(Contents.end(), Operands.begin(), Operands.end());
llvm::append_range(Contents, Operands);
}

void dwarfgen::LineTable::addExtendedOpcode(uint64_t Length, uint8_t Opcode,
ArrayRef<ValueAndLength> Operands) {
Contents.push_back({0, Byte});
Contents.push_back({Length, ULEB});
Contents.push_back({Opcode, Byte});
Contents.insert(Contents.end(), Operands.begin(), Operands.end());
llvm::append_range(Contents, Operands);
}

void dwarfgen::LineTable::generate(MCContext &MC, AsmPrinter &Asm) const {
Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/DebugInfo/PDB/HashTableTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ struct FooBarHashTraits {

uint32_t lookupKeyToStorageKey(StringRef S) {
uint32_t N = Buffer.size();
Buffer.insert(Buffer.end(), S.begin(), S.end());
llvm::append_range(Buffer, S);
Buffer.push_back('\0');
return N;
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/Transforms/IPO/LowerTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ TEST(LowerTypeTests, GlobalLayoutBuilder) {

std::vector<uint64_t> ComputedLayout;
for (auto &&F : GLB.Fragments)
ComputedLayout.insert(ComputedLayout.end(), F.begin(), F.end());
llvm::append_range(ComputedLayout, F);

EXPECT_EQ(T.WantLayout, ComputedLayout);
}
Expand Down
6 changes: 3 additions & 3 deletions llvm/utils/TableGen/Common/CodeGenRegisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ struct TupleExpander : SetTheory::Expander {
// Take the cost list of the first register in the tuple.
const ListInit *CostList = Proto->getValueAsListInit("CostPerUse");
SmallVector<const Init *, 2> CostPerUse;
CostPerUse.insert(CostPerUse.end(), CostList->begin(), CostList->end());
llvm::append_range(CostPerUse, *CostList);

const StringInit *AsmName = StringInit::get(RK, "");
if (!RegNames.empty()) {
Expand Down Expand Up @@ -1186,7 +1186,7 @@ void CodeGenRegisterClass::extendSuperRegClasses(CodeGenSubRegIndex *SubIdx) {
return;

SmallVector<CodeGenRegisterClass *> MidRCs;
MidRCs.insert(MidRCs.end(), It->second.begin(), It->second.end());
llvm::append_range(MidRCs, It->second);

for (CodeGenRegisterClass *MidRC : MidRCs) {
for (auto &Pair : MidRC->SuperRegClasses) {
Expand Down Expand Up @@ -1244,7 +1244,7 @@ CodeGenRegBank::CodeGenRegBank(const RecordKeeper &Records,
for (const Record *R : Records.getAllDerivedDefinitions("RegisterTuples")) {
// Expand tuples and merge the vectors
std::vector<const Record *> TupRegs = *Sets.expand(R);
Regs.insert(Regs.end(), TupRegs.begin(), TupRegs.end());
llvm::append_range(Regs, TupRegs);
}

llvm::sort(Regs, LessRecordRegister());
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/RegisterInfoEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ void RegisterInfoEmitter::runTargetDesc(raw_ostream &OS) {
// each register. Fill with zero for values which are not explicitly given.
for (const auto &Reg : Regs) {
auto Costs = Reg.CostPerUse;
AllRegCostPerUse.insert(AllRegCostPerUse.end(), Costs.begin(), Costs.end());
llvm::append_range(AllRegCostPerUse, Costs);
if (NumRegCosts > Costs.size())
AllRegCostPerUse.insert(AllRegCostPerUse.end(),
NumRegCosts - Costs.size(), 0);
Expand Down
Loading