@@ -120,7 +120,7 @@ template <class ELFT> class ICF {
120
120
void forEachClassRange (size_t begin, size_t end,
121
121
llvm::function_ref<void (size_t , size_t )> fn);
122
122
123
- void forEachClass (llvm::function_ref<void (size_t , size_t )> fn);
123
+ void parallelForEachClass (llvm::function_ref<void (size_t , size_t )> fn);
124
124
125
125
Ctx &ctx;
126
126
SmallVector<InputSection *, 0 > sections;
@@ -432,8 +432,10 @@ void ICF<ELFT>::forEachClassRange(size_t begin, size_t end,
432
432
}
433
433
434
434
// Call Fn on each equivalence class.
435
+
435
436
template <class ELFT >
436
- void ICF<ELFT>::forEachClass(llvm::function_ref<void (size_t , size_t )> fn) {
437
+ void ICF<ELFT>::parallelForEachClass(
438
+ llvm::function_ref<void (size_t , size_t )> fn) {
437
439
// If threading is disabled or the number of sections are
438
440
// too small to use threading, call Fn sequentially.
439
441
if (parallel::strategy.ThreadsRequested == 1 || sections.size () < 1024 ) {
@@ -541,14 +543,14 @@ template <class ELFT> void ICF<ELFT>::run() {
541
543
// static content. Use a base offset for these IDs to ensure no overlap with
542
544
// the unique IDs already assigned.
543
545
uint32_t eqClassBase = ++uniqueId;
544
- forEachClass ([&](size_t begin, size_t end) {
546
+ parallelForEachClass ([&](size_t begin, size_t end) {
545
547
segregate (begin, end, eqClassBase, true );
546
548
});
547
549
548
550
// Split groups by comparing relocations until convergence is obtained.
549
551
do {
550
552
repeat = false ;
551
- forEachClass ([&](size_t begin, size_t end) {
553
+ parallelForEachClass ([&](size_t begin, size_t end) {
552
554
segregate (begin, end, eqClassBase, false );
553
555
});
554
556
} while (repeat);
0 commit comments