[PATCH] D133780: [lld-macho] Have ICF dedup explicitly-defined selrefs

Roger Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 11:00:02 PDT 2022


Roger added inline comments.


================
Comment at: lld/MachO/ICF.cpp:414
   // ICF::segregate()
   std::vector<ConcatInputSection *> hashable;
   uint64_t icfUniqueID = inputSections.size();
----------------
int3 wrote:
> hm I should rename this to `foldable` too
Agreed :)


================
Comment at: lld/MachO/ICF.cpp:417-423
+    bool isFoldableWithAddendsRemoved = isCfStringSection(isec) ||
+                                        isClassRefsSection(isec) ||
+                                        isSelRefsSection(isec);
+    // __objc_selrefs is typically marked as no_dead_strip but that doesn't stop
+    // ld64 from folding it
+    bool hasFoldableFlags = (isSelRefsSection(isec) ||
+                             sectionType(isec->getFlags()) == MachO::S_REGULAR);
----------------
I really appreciate pulling out these boolean expressions into their own variables to give a name to what they represent. If it can be done any further, I'd really encourage it :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133780



More information about the llvm-commits mailing list