[all-commits] [llvm/llvm-project] 96cb97: [ThinLTO] Update combined index for SamplePGO indi...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Fri Sep 24 12:30:08 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 96cb97c4533a0a02c2d62ffb1121cd275aa43dd5
      https://github.com/llvm/llvm-project/commit/96cb97c4533a0a02c2d62ffb1121cd275aa43dd5
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2021-09-24 (Fri, 24 Sep 2021)

  Changed paths:
    M llvm/include/llvm/IR/ModuleSummaryIndex.h
    M llvm/include/llvm/Transforms/IPO/FunctionImport.h
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/IR/ModuleSummaryIndex.cpp
    M llvm/lib/Transforms/IPO/FunctionImport.cpp
    M llvm/tools/llvm-lto/llvm-lto.cpp

  Log Message:
  -----------
  [ThinLTO] Update combined index for SamplePGO indirect calls to locals

In ThinLTO for locals we normally compute the GUID from the name after
prepending the source path to get a unique global id. SamplePGO indirect
call profiles contain the target GUID without this uniquification,
however (unless compiling with -funique-internal-linkage-names).

In order to correctly handle the call edges added to the combined index
for these indirect calls, during importing and bitcode writing we
consult a map of original to full GUID to identify the actual callee.
However, for a large application this was consuming a lot of compile
time as we need to do this repeatedly (especially during importing where
we may traverse call edges multiple times).

To fix this implement a suggestion in one of the FIXME comments, and
actually modify the call edges during a single traversal after the index
is built to perform the fixups once. I combined this fixup with the dead
code analysis performed on the index in order to avoid adding an
additional walk of the index. The dead code analysis is the first
analysis performed on the index.

This reduced the time required for a large thin link with SamplePGO by
about 20%.

No new test added, but I confirmed that there are existing tests that
will fail when no fixup is performed.

Differential Revision: https://reviews.llvm.org/D110374




More information about the All-commits mailing list