[PATCH] D104670: [lld-macho] Move ICF members from InputSection to ConcatInputSection

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 24 14:47:26 PDT 2021


gkm accepted this revision.
gkm added a comment.
This revision is now accepted and ready to land.

Bueno!



================
Comment at: lld/MachO/ICF.cpp:138
+        const auto *isecB = cast<ConcatInputSection>(sb);
+        if (isecB->icfEqClass[icfPass % 2] != isecB->icfEqClass[icfPass % 2])
+          return false;
----------------



================
Comment at: lld/MachO/ICF.cpp:212
+            if (defined->isec)
+              if (auto isec = cast<ConcatInputSection>(defined->isec))
+                hash += isec->icfEqClass[icfPass % 2];
----------------



================
Comment at: lld/MachO/InputSection.cpp:65
   case S_LITERAL_POINTERS:
-    // FIXME(gkm): once literal sections are deduplicated, their content and
-    // identity correlate, so we can assign unique IDs to them rather than hash
-    // them.
-    return true;
+    // FIXME(jezng): We should have any ConcatInputSections of these types when
+    // running ICF.
----------------



================
Comment at: lld/MachO/UnwindInfoSection.cpp:156
            rFunc.offset + offsetof(CompactUnwindEntry<Ptr>, personality));
-    rFunc.referent.get<InputSection *>()->hasPersonality = true;
+    auto referentIsec =
+        cast<ConcatInputSection>(rFunc.referent.get<InputSection *>());
----------------



================
Comment at: lld/MachO/Writer.cpp:970
   for (InputSection *isec : inputSections) {
-    if (isec->isHashableForICF(isec->parent == textOutputSection))
-      hashable.push_back(isec);
-    else
-      isec->icfEqClass[0] = ++icfUniqueID;
+    if (auto concatIsec = dyn_cast<ConcatInputSection>(isec)) {
+      if (concatIsec->isHashableForICF(isec->parent == textOutputSection))
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104670/new/

https://reviews.llvm.org/D104670



More information about the llvm-commits mailing list