Skip to content

Commit 7effcbd

Browse files
committed
Rename parallelForEachN to just parallelFor
Patch created by running: rg -l parallelForEachN | xargs sed -i '' -c 's/parallelForEachN/parallelFor/' No behavior change. Differential Revision: https://reviews.llvm.org/D128140
1 parent a5cb6ed commit 7effcbd

File tree

19 files changed

+32
-33
lines changed

19 files changed

+32
-33
lines changed

lld/COFF/DebugTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ void TypeMerger::mergeTypesWithGHash() {
10561056
// position. Because the table does not rehash, the position will not change
10571057
// under insertion. After insertion is done, the value of the cell can be read
10581058
// to retrieve the final PDB type index.
1059-
parallelForEachN(0, ctx.tpiSourceList.size(), [&](size_t tpiSrcIdx) {
1059+
parallelFor(0, ctx.tpiSourceList.size(), [&](size_t tpiSrcIdx) {
10601060
TpiSource *source = ctx.tpiSourceList[tpiSrcIdx];
10611061
source->indexMapStorage.resize(source->ghashes.size());
10621062
for (uint32_t i = 0, e = source->ghashes.size(); i < e; i++) {

lld/COFF/ICF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ void ICF::forEachClass(std::function<void(size_t, size_t)> fn) {
233233
size_t boundaries[numShards + 1];
234234
boundaries[0] = 0;
235235
boundaries[numShards] = chunks.size();
236-
parallelForEachN(1, numShards, [&](size_t i) {
236+
parallelFor(1, numShards, [&](size_t i) {
237237
boundaries[i] = findBoundary((i - 1) * step, chunks.size());
238238
});
239-
parallelForEachN(1, numShards + 1, [&](size_t i) {
239+
parallelFor(1, numShards + 1, [&](size_t i) {
240240
if (boundaries[i - 1] < boundaries[i]) {
241241
forEachClassRange(boundaries[i - 1], boundaries[i], fn);
242242
}

lld/COFF/LLDMapFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static SymbolMapTy getSectionSyms(ArrayRef<DefinedRegular *> syms) {
7575
static DenseMap<DefinedRegular *, std::string>
7676
getSymbolStrings(ArrayRef<DefinedRegular *> syms) {
7777
std::vector<std::string> str(syms.size());
78-
parallelForEachN((size_t)0, syms.size(), [&](size_t i) {
78+
parallelFor((size_t)0, syms.size(), [&](size_t i) {
7979
raw_string_ostream os(str[i]);
8080
writeHeader(os, syms[i]->getRVA(), 0, 0);
8181
os << indent16 << toString(*syms[i]);

lld/COFF/MapFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static void getSymbols(const COFFLinkerContext &ctx,
141141
static DenseMap<Defined *, std::string>
142142
getSymbolStrings(const COFFLinkerContext &ctx, ArrayRef<Defined *> syms) {
143143
std::vector<std::string> str(syms.size());
144-
parallelForEachN((size_t)0, syms.size(), [&](size_t i) {
144+
parallelFor((size_t)0, syms.size(), [&](size_t i) {
145145
raw_string_ostream os(str[i]);
146146
Defined *sym = syms[i];
147147

lld/ELF/ICF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,11 @@ void ICF<ELFT>::forEachClass(llvm::function_ref<void(size_t, size_t)> fn) {
422422
boundaries[0] = 0;
423423
boundaries[numShards] = sections.size();
424424

425-
parallelForEachN(1, numShards, [&](size_t i) {
425+
parallelFor(1, numShards, [&](size_t i) {
426426
boundaries[i] = findBoundary((i - 1) * step, sections.size());
427427
});
428428

429-
parallelForEachN(1, numShards + 1, [&](size_t i) {
429+
parallelFor(1, numShards + 1, [&](size_t i) {
430430
if (boundaries[i - 1] < boundaries[i])
431431
forEachClassRange(boundaries[i - 1], boundaries[i], fn);
432432
});

lld/ELF/MapFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static SymbolMapTy getSectionSyms(ArrayRef<Defined *> syms) {
9292
static DenseMap<Symbol *, std::string>
9393
getSymbolStrings(ArrayRef<Defined *> syms) {
9494
auto strs = std::make_unique<std::string[]>(syms.size());
95-
parallelForEachN(0, syms.size(), [&](size_t i) {
95+
parallelFor(0, syms.size(), [&](size_t i) {
9696
raw_string_ostream os(strs[i]);
9797
OutputSection *osec = syms[i]->getOutputSection();
9898
uint64_t vma = syms[i]->getVA();

lld/ELF/OutputSections.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ template <class ELFT> void OutputSection::maybeCompress() {
350350
// concatenated with the next shard.
351351
auto shardsOut = std::make_unique<SmallVector<uint8_t, 0>[]>(numShards);
352352
auto shardsAdler = std::make_unique<uint32_t[]>(numShards);
353-
parallelForEachN(0, numShards, [&](size_t i) {
353+
parallelFor(0, numShards, [&](size_t i) {
354354
shardsOut[i] = deflateShard(shardsIn[i], level,
355355
i != numShards - 1 ? Z_SYNC_FLUSH : Z_FINISH);
356356
shardsAdler[i] = adler32(1, shardsIn[i].data(), shardsIn[i].size());
@@ -409,7 +409,7 @@ template <class ELFT> void OutputSection::writeTo(uint8_t *buf) {
409409

410410
buf[0] = 0x78; // CMF
411411
buf[1] = 0x01; // FLG: best speed
412-
parallelForEachN(0, compressed.numShards, [&](size_t i) {
412+
parallelFor(0, compressed.numShards, [&](size_t i) {
413413
memcpy(buf + offsets[i], compressed.shards[i].data(),
414414
compressed.shards[i].size());
415415
});
@@ -425,7 +425,7 @@ template <class ELFT> void OutputSection::writeTo(uint8_t *buf) {
425425
if (nonZeroFiller)
426426
fill(buf, sections.empty() ? size : sections[0]->outSecOff, filler);
427427

428-
parallelForEachN(0, sections.size(), [&](size_t i) {
428+
parallelFor(0, sections.size(), [&](size_t i) {
429429
InputSection *isec = sections[i];
430430
if (auto *s = dyn_cast<SyntheticSection>(isec))
431431
s->writeTo(buf + isec->outSecOff);
@@ -623,7 +623,7 @@ void OutputSection::checkDynRelAddends(const uint8_t *bufStart) {
623623
assert(config->writeAddends && config->checkDynamicRelocs);
624624
assert(type == SHT_REL || type == SHT_RELA);
625625
SmallVector<InputSection *, 0> sections = getInputSections(*this);
626-
parallelForEachN(0, sections.size(), [&](size_t i) {
626+
parallelFor(0, sections.size(), [&](size_t i) {
627627
// When linking with -r or --emit-relocs we might also call this function
628628
// for input .rel[a].<sec> sections which we simply pass through to the
629629
// output. We skip over those and only look at the synthetic relocation

lld/ELF/SyntheticSections.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,7 +2841,7 @@ static SmallVector<GdbIndexSection::GdbSymbol, 0> createSymbols(
28412841
// Instantiate GdbSymbols while uniqufying them by name.
28422842
auto symbols = std::make_unique<SmallVector<GdbSymbol, 0>[]>(numShards);
28432843

2844-
parallelForEachN(0, concurrency, [&](size_t threadId) {
2844+
parallelFor(0, concurrency, [&](size_t threadId) {
28452845
uint32_t i = 0;
28462846
for (ArrayRef<NameAttrEntry> entries : nameAttrs) {
28472847
for (const NameAttrEntry &ent : entries) {
@@ -2921,7 +2921,7 @@ template <class ELFT> GdbIndexSection *GdbIndexSection::create() {
29212921
SmallVector<GdbChunk, 0> chunks(files.size());
29222922
SmallVector<SmallVector<NameAttrEntry, 0>, 0> nameAttrs(files.size());
29232923

2924-
parallelForEachN(0, files.size(), [&](size_t i) {
2924+
parallelFor(0, files.size(), [&](size_t i) {
29252925
// To keep memory usage low, we don't want to keep cached DWARFContext, so
29262926
// avoid getDwarf() here.
29272927
ObjFile<ELFT> *file = cast<ObjFile<ELFT>>(files[i]);
@@ -3287,8 +3287,8 @@ void MergeTailSection::finalizeContents() {
32873287
}
32883288

32893289
void MergeNoTailSection::writeTo(uint8_t *buf) {
3290-
parallelForEachN(0, numShards,
3291-
[&](size_t i) { shards[i].write(buf + shardOffsets[i]); });
3290+
parallelFor(0, numShards,
3291+
[&](size_t i) { shards[i].write(buf + shardOffsets[i]); });
32923292
}
32933293

32943294
// This function is very hot (i.e. it can take several seconds to finish)
@@ -3312,7 +3312,7 @@ void MergeNoTailSection::finalizeContents() {
33123312
numShards));
33133313

33143314
// Add section pieces to the builders.
3315-
parallelForEachN(0, concurrency, [&](size_t threadId) {
3315+
parallelFor(0, concurrency, [&](size_t threadId) {
33163316
for (MergeInputSection *sec : sections) {
33173317
for (size_t i = 0, e = sec->pieces.size(); i != e; ++i) {
33183318
if (!sec->pieces[i].live)

lld/ELF/Writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ computeHash(llvm::MutableArrayRef<uint8_t> hashBuf,
29152915
std::unique_ptr<uint8_t[]> hashes(new uint8_t[hashesSize]);
29162916

29172917
// Compute hash values.
2918-
parallelForEachN(0, chunks.size(), [&](size_t i) {
2918+
parallelFor(0, chunks.size(), [&](size_t i) {
29192919
hashFn(hashes.get() + i * hashBuf.size(), chunks[i]);
29202920
});
29212921

lld/MachO/ICF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ void ICF::forEachClass(llvm::function_ref<void(size_t, size_t)> func) {
270270
size_t boundaries[shards + 1];
271271
boundaries[0] = 0;
272272
boundaries[shards] = icfInputs.size();
273-
parallelForEachN(1, shards, [&](size_t i) {
273+
parallelFor(1, shards, [&](size_t i) {
274274
boundaries[i] = findBoundary((i - 1) * step, icfInputs.size());
275275
});
276-
parallelForEachN(1, shards + 1, [&](size_t i) {
276+
parallelFor(1, shards + 1, [&](size_t i) {
277277
if (boundaries[i - 1] < boundaries[i]) {
278278
forEachClassRange(boundaries[i - 1], boundaries[i], func);
279279
}

0 commit comments

Comments
 (0)