@@ -120,7 +120,7 @@ template <class ELFT> class ICF {
120120 void forEachClassRange (size_t begin, size_t end,
121121 llvm::function_ref<void (size_t , size_t )> fn);
122122
123- void forEachClass (llvm::function_ref<void (size_t , size_t )> fn);
123+ void parallelForEachClass (llvm::function_ref<void (size_t , size_t )> fn);
124124
125125 Ctx &ctx;
126126 SmallVector<InputSection *, 0 > sections;
@@ -432,8 +432,10 @@ void ICF<ELFT>::forEachClassRange(size_t begin, size_t end,
432432}
433433
434434// Call Fn on each equivalence class.
435+
435436template <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) {
437439 // If threading is disabled or the number of sections are
438440 // too small to use threading, call Fn sequentially.
439441 if (parallel::strategy.ThreadsRequested == 1 || sections.size () < 1024 ) {
@@ -541,14 +543,14 @@ template <class ELFT> void ICF<ELFT>::run() {
541543 // static content. Use a base offset for these IDs to ensure no overlap with
542544 // the unique IDs already assigned.
543545 uint32_t eqClassBase = ++uniqueId;
544- forEachClass ([&](size_t begin, size_t end) {
546+ parallelForEachClass ([&](size_t begin, size_t end) {
545547 segregate (begin, end, eqClassBase, true );
546548 });
547549
548550 // Split groups by comparing relocations until convergence is obtained.
549551 do {
550552 repeat = false ;
551- forEachClass ([&](size_t begin, size_t end) {
553+ parallelForEachClass ([&](size_t begin, size_t end) {
552554 segregate (begin, end, eqClassBase, false );
553555 });
554556 } while (repeat);
0 commit comments