[PATCH] D36351: [lld][ELF] Add profile guided section layout

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 18:33:00 PST 2017


ruiu added inline comments.


================
Comment at: lld/ELF/CallGraphSort.cpp:208
+  Edge CE = Edges[CEI];
+  if (CE.From == CE.To) {
+    auto I = WorkLookup.find(CEI);
----------------
Bigcheese wrote:
> ruiu wrote:
> > How can the graph have a self edge?
> Two symbols which are in the same section.
Can you elaborate? I'm trying to understand it, so giving me just an answer isn't that helpful to me.


================
Comment at: lld/ELF/CallGraphSort.cpp:248-249
+  // as equal edges will be merged in an order independent manner.
+  std::sort(FE.begin(), FE.end(),
+            [&](EdgeIndex AI, EdgeIndex BI) { return Edges[AI] < Edges[BI]; });
+
----------------
Bigcheese wrote:
> ruiu wrote:
> > Can't this just be `std::sort(FE.begin(), FE.end())`?
> No.
Why?


https://reviews.llvm.org/D36351





More information about the llvm-commits mailing list