[PATCH] D49622: ELF: Make sections with KeepUnique bit eligible for ICF.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 16:07:01 PDT 2018


ruiu added inline comments.


================
Comment at: lld/ELF/ICF.cpp:471
       return;
-    print("selected section " + toString(Sections[Begin]));
-    for (size_t I = Begin + 1; I < End; ++I) {
+    InputSection *Target = nullptr;
+    bool SeenUnique = false, Replaced = false;
----------------
I guess this could be a bit simpler:

  for (size_t I = Begin + 1; I < End; ++I) {
    if (Sections[Begin]->KeepUnique && Sections[I]->KeepUnique)
      Begin = I;
    else
      Sections[Begin]->replace(Sections[I]);
  }


https://reviews.llvm.org/D49622





More information about the llvm-commits mailing list