[PATCH] D128452: [PGL][LTO] Make PGL work with FLTO (PR #56185)

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 18:56:44 PDT 2022


bd1976llvm added a subscriber: nikic.
bd1976llvm added a comment.

In D128452#3607209 <https://reviews.llvm.org/D128452#3607209>, @nikic wrote:

> (Not familiar with CGProfilePass and its requirements)

This change should be relatively simple to understand with a bit more background: For PGL the compiler must emit the .llvm.call-graph-profile (SHT_LLVM_CALL_GRAPH_PROFILE) section to the ELF object file that LLD consumes. To do this the CGProfilePass attaches additional metadata recording the weighted call-graph, which is later lowered to the  .llvm.call-graph-profile ELF section contents. This currently works for normal compilation and TLTO; however, for FLTO the pass is currently run in the pre-link stage so the weighted callgraph metadata is present in the bitcode input to LLD. Since the metadata is attached too early it does not survive LTO compilation to lowering and the .llvm.call-graph-profile section is not present in the LTO object file. In this change we make the CGProfilePass run at the right point during the LTO object file compilation so that the LTO object file contains the .llvm.call-graph-profile section which LLD can consume to drive PGL.

More background in this talk: https://youtu.be/F-lbgspxv1c


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

https://reviews.llvm.org/D128452



More information about the llvm-commits mailing list