[PATCH] D123752: [lld] Implement safe icf for MachO

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 12:27:36 PDT 2022


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

lgtm!



================
Comment at: lld/MachO/ICF.h:12
 
+#include "InputFiles.h"
 #include "lld/Common/LLVM.h"
----------------
could forward-declare `InputFile` and move this include to the .cpp


================
Comment at: lld/MachO/ICF.h:21
 
+void markAddrSigSymbols(llvm::SetVector<InputFile *> &inputFiles);
+void markSymAsAddrSig(Symbol *s);
----------------
oops, I belatedly realized that `inputFiles` is a global as well, doesn't need to be passed either :D

(we could do away with the `SetVector.h` include in that case)


================
Comment at: lld/test/MachO/icf-safe.s:9-11
+; ICFSAFE:       {{[0-9a-f \:]*}}  bl _func02
+; ICFSAFE-NEXT:  {{[0-9a-f \:]*}}  bl _func02
+; ICFSAFE-NEXT:  {{[0-9a-f \:]*}}  bl _func03_takeaddr
----------------
FileCheck operates via substring matching by default, so there's no need for the regex

nit: also align the lines with the `_callAllFunctions` line above


================
Comment at: lld/test/MachO/icf-safe.s:23
+
+; Function Attrs: minsize nofree noinline norecurse nounwind optsize ssp uwtable
+define void @func01() local_unnamed_addr #0 {
----------------
should remove the other attributes we deleted below (or just remove the entire comment altogether)


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

https://reviews.llvm.org/D123752



More information about the llvm-commits mailing list