[PATCH] D121051: [lld-macho][nfc] Track # of ICF calls to `equals*` methods
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 09:37:21 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
int3 marked an inline comment as done.
Closed by commit rG64cc719766ec: [lld-macho][nfc] Track # of ICF calls to `equals*` methods (authored by int3).
Changed prior to commit:
https://reviews.llvm.org/D121051?vs=413223&id=413526#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121051/new/
https://reviews.llvm.org/D121051
Files:
lld/MachO/ICF.cpp
Index: lld/MachO/ICF.cpp
===================================================================
--- lld/MachO/ICF.cpp
+++ lld/MachO/ICF.cpp
@@ -23,6 +23,8 @@
using namespace lld;
using namespace lld::macho;
+static constexpr bool verboseDiagnostics = false;
+
class ICF {
public:
ICF(std::vector<ConcatInputSection *> &inputs);
@@ -47,6 +49,8 @@
unsigned icfPass = 0;
std::atomic<bool> icfRepeat{false};
+ std::atomic<uint64_t> equalsConstantCount{0};
+ std::atomic<uint64_t> equalsVariableCount{0};
};
ICF::ICF(std::vector<ConcatInputSection *> &inputs) {
@@ -87,6 +91,8 @@
// except references to other ConcatInputSections.
bool ICF::equalsConstant(const ConcatInputSection *ia,
const ConcatInputSection *ib) {
+ if (verboseDiagnostics)
+ ++equalsConstantCount;
// We can only fold within the same OutputSection.
if (ia->parent != ib->parent)
return false;
@@ -159,6 +165,8 @@
// handled by equalsConstant().
bool ICF::equalsVariable(const ConcatInputSection *ia,
const ConcatInputSection *ib) {
+ if (verboseDiagnostics)
+ ++equalsVariableCount;
assert(ia->relocs.size() == ib->relocs.size());
auto f = [this](const Reloc &ra, const Reloc &rb) {
// We already filtered out mismatching values/addends in equalsConstant.
@@ -307,6 +315,10 @@
});
} while (icfRepeat);
log("ICF needed " + Twine(icfPass) + " iterations");
+ if (verboseDiagnostics) {
+ log("equalsConstant() called " + Twine(equalsConstantCount) + " times");
+ log("equalsVariable() called " + Twine(equalsVariableCount) + " times");
+ }
// Fold sections within equivalence classes
forEachClass([&](size_t begin, size_t end) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121051.413526.patch
Type: text/x-patch
Size: 1725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220307/38816376/attachment.bin>
More information about the llvm-commits
mailing list