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

Michael Spencer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 19:47:40 PST 2017


Bigcheese added inline comments.


================
Comment at: lld/ELF/Options.td:54-58
+def call_graph_profile_file: S<"call-graph-profile-file">,
+  HelpText<"Layout sections to optimize the given callgraph">;
+
+def call_graph_profile_sort: F<"call-graph-profile-sort">,
+  HelpText<"Sort sections by call graph profile information">;
----------------
ruiu wrote:
> Bigcheese wrote:
> > ruiu wrote:
> > > I think these two options should be merged into one option which takes a filename as an argument and enables the feature.
> > A text file is not the only way to get input for sorting. The input can also come from object files.
> Yeah, that actually confused me. How a compiler can add information related to profiling data to an object file being generated? I don't think I understand how the new .note section works.
When you do -fprofile-instr-use=<path> the compiler adds profile data from that file to the IR as metadat. The cgprofile pass uses that metadata to generate metadata for the call graph profile. It then writes that to the object file.


https://reviews.llvm.org/D36351





More information about the llvm-commits mailing list