[PATCH] D152840: A new code layout algorithm for function reordering [3a/3]

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 21:12:12 PDT 2023


MaskRay added inline comments.


================
Comment at: lld/ELF/CallGraphSort.cpp:9
 ///
 /// Implementation of Call-Chain Clustering from: Optimizing Function Placement
 /// for Large-Scale Data-Center Applications
----------------
This large comment is now stale.


================
Comment at: lld/ELF/CallGraphSort.cpp:267
+// Fill in necessary data for Cache-Directed Sort.
+void buildCallGraph(std::vector<uint64_t> &FuncSizes,
+                    std::vector<uint64_t> &FuncCounts,
----------------
MaskRay wrote:
> lld/ code uses `variableName`. Please fix.
`static void`


================
Comment at: lld/ELF/CallGraphSort.cpp:302
+    size_t To = getOrCreateNode(ToSB);
+
+    // Ignore self-edges (recursive calls).
----------------
We don't add a blank line after variable declarations.


================
Comment at: lld/ELF/CallGraphSort.cpp:307
+
+    auto It = std::make_pair(From, To);
+    CallCounts.push_back(std::make_pair(It, Weight));
----------------
inline the used-once variable.


================
Comment at: lld/ELF/Options.td:340
 
+defm use_cdsort: B<"use-cdsort",
+    "Use cache-directed-sort to reorder functions in the binary (default)",
----------------
New options use `BB`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152840



More information about the llvm-commits mailing list