Skip to content

Commit 6257621

Browse files
[llvm] Use llvm::append_range (NFC) (#133658)
1 parent 94122d5 commit 6257621

File tree

16 files changed

+22
-46
lines changed

16 files changed

+22
-46
lines changed

llvm/include/llvm/CodeGen/TileShapeInfo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class ShapeT {
4848
ColImm(InvalidImmShape) {
4949
assert(ShapesOperands.size() % 2 == 0 && "Miss row or col!");
5050

51-
for (auto *Shape : ShapesOperands)
52-
Shapes.push_back(Shape);
51+
llvm::append_range(Shapes, ShapesOperands);
5352

5453
if (MRI)
5554
deduceImm(MRI);

llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class ShuffleMask {
4343
static ShuffleMask getIdentity(unsigned Sz) {
4444
IndicesVecT Indices;
4545
Indices.reserve(Sz);
46-
for (auto Idx : seq<int>(0, (int)Sz))
47-
Indices.push_back(Idx);
46+
llvm::append_range(Indices, seq<int>(0, (int)Sz));
4847
return ShuffleMask(std::move(Indices));
4948
}
5049
/// \Returns true if the mask is a perfect identity mask with consecutive

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,10 +3339,8 @@ Error BitcodeReader::parseConstants() {
33393339
if (Record.empty())
33403340
return error("Invalid aggregate record");
33413341

3342-
unsigned Size = Record.size();
33433342
SmallVector<unsigned, 16> Elts;
3344-
for (unsigned i = 0; i != Size; ++i)
3345-
Elts.push_back(Record[i]);
3343+
llvm::append_range(Elts, Record);
33463344

33473345
if (isa<StructType>(CurTy)) {
33483346
V = BitcodeConstant::create(

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,7 @@ void ModuleBitcodeWriter::writeTypeTable() {
12091209
TypeVals.push_back(TET->getNumTypeParameters());
12101210
for (Type *InnerTy : TET->type_params())
12111211
TypeVals.push_back(VE.getTypeID(InnerTy));
1212-
for (unsigned IntParam : TET->int_params())
1213-
TypeVals.push_back(IntParam);
1212+
llvm::append_range(TypeVals, TET->int_params());
12141213
break;
12151214
}
12161215
case Type::TypedPointerTyID:
@@ -4303,10 +4302,8 @@ static void writeFunctionHeapProfileRecords(
43034302
}
43044303
for (auto Id : CI.StackIdIndices)
43054304
Record.push_back(GetStackIndex(Id));
4306-
if (!PerModule) {
4307-
for (auto V : CI.Clones)
4308-
Record.push_back(V);
4309-
}
4305+
if (!PerModule)
4306+
llvm::append_range(Record, CI.Clones);
43104307
Stream.EmitRecord(PerModule ? bitc::FS_PERMODULE_CALLSITE_INFO
43114308
: bitc::FS_COMBINED_CALLSITE_INFO,
43124309
Record, CallsiteAbbrev);
@@ -4326,10 +4323,8 @@ static void writeFunctionHeapProfileRecords(
43264323
assert(CallStackCount <= CallStackPos.size());
43274324
Record.push_back(CallStackPos[CallStackCount++]);
43284325
}
4329-
if (!PerModule) {
4330-
for (auto V : AI.Versions)
4331-
Record.push_back(V);
4332-
}
4326+
if (!PerModule)
4327+
llvm::append_range(Record, AI.Versions);
43334328
assert(AI.ContextSizeInfos.empty() ||
43344329
AI.ContextSizeInfos.size() == AI.MIBs.size());
43354330
// Optionally emit the context size information if it exists.

llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ void LVPatterns::addGenericPatterns(StringSet<> &Patterns) {
445445
}
446446

447447
void LVPatterns::addOffsetPatterns(const LVOffsetSet &Patterns) {
448-
for (const LVOffset &Entry : Patterns)
449-
OffsetMatchInfo.push_back(Entry);
448+
llvm::append_range(OffsetMatchInfo, Patterns);
450449
if (OffsetMatchInfo.size()) {
451450
options().setSelectOffsetPattern();
452451
options().setSelectExecute();

llvm/lib/DebugInfo/LogicalView/Core/LVSymbol.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ void LVSymbol::getLocations(LVLocations &LocationList) const {
182182
if (!Locations)
183183
return;
184184

185-
for (LVLocation *Location : *Locations)
186-
LocationList.push_back(Location);
185+
llvm::append_range(LocationList, *Locations);
187186
}
188187

189188
// Calculate coverage factor.

llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ void LVCodeViewReader::cacheRelocations() {
163163
const coff_section *CoffSection = getObj().getCOFFSection(Section);
164164

165165
auto &RM = RelocMap[CoffSection];
166-
for (const RelocationRef &Relocacion : Section.relocations())
167-
RM.push_back(Relocacion);
166+
llvm::append_range(RM, Section.relocations());
168167

169168
// Sort relocations by address.
170169
llvm::sort(RM, [](RelocationRef L, RelocationRef R) {

llvm/lib/FileCheck/FileCheck.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,13 +1640,11 @@ static const char *DefaultCommentPrefixes[] = {"COM", "RUN"};
16401640

16411641
static void addDefaultPrefixes(FileCheckRequest &Req) {
16421642
if (Req.CheckPrefixes.empty()) {
1643-
for (const char *Prefix : DefaultCheckPrefixes)
1644-
Req.CheckPrefixes.push_back(Prefix);
1643+
llvm::append_range(Req.CheckPrefixes, DefaultCheckPrefixes);
16451644
Req.IsDefaultCheckPrefix = true;
16461645
}
16471646
if (Req.CommentPrefixes.empty())
1648-
for (const char *Prefix : DefaultCommentPrefixes)
1649-
Req.CommentPrefixes.push_back(Prefix);
1647+
llvm::append_range(Req.CommentPrefixes, DefaultCommentPrefixes);
16501648
}
16511649

16521650
struct PrefixMatcher {

llvm/lib/ObjCopy/COFF/COFFReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ Error COFFReader::readSections(Object &Obj) const {
7070
return E;
7171
S.setContentsRef(Contents);
7272
ArrayRef<coff_relocation> Relocs = COFFObj.getRelocations(Sec);
73-
for (const coff_relocation &R : Relocs)
74-
S.Relocs.push_back(R);
73+
llvm::append_range(S.Relocs, Relocs);
7574
if (Expected<StringRef> NameOrErr = COFFObj.getSectionName(Sec))
7675
S.Name = *NameOrErr;
7776
else

llvm/lib/ObjCopy/XCOFF/XCOFFReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ Error XCOFFReader::readSections(Object &Obj) const {
3838
XCOFFObj.relocations<XCOFFSectionHeader32, XCOFFRelocation32>(Sec);
3939
if (!Relocations)
4040
return Relocations.takeError();
41-
for (const XCOFFRelocation32 &Rel : Relocations.get())
42-
ReadSec.Relocations.push_back(Rel);
41+
llvm::append_range(ReadSec.Relocations, Relocations.get());
4342
}
4443

4544
Obj.Sections.push_back(std::move(ReadSec));

0 commit comments

Comments
 (0)