[ThinLTO] Perform profile-guided indirect call promotion
authorTeresa Johnson <tejohnson@google.com>
Sun, 17 Jul 2016 14:47:01 +0000 (14:47 +0000)
committerTeresa Johnson <tejohnson@google.com>
Sun, 17 Jul 2016 14:47:01 +0000 (14:47 +0000)
commite2f34269f3bcdf9e8134247b94e40a29bf0a37a3
treef3c71dceab6d3cbcf8ac9dc66bd7ac6884efa094
parent350718ee80b7cfe5f86c57ac0fcd2e7aebe699a9
[ThinLTO] Perform profile-guided indirect call promotion

Summary:
To enable profile-guided indirect call promotion in ThinLTO mode, we
simply add call graph edges for each profitable target from the profile
to the summaries, then the summary-guided importing will consider the
callee for importing as usual.

Also we need to enable the indirect call promotion pass creation in the
PassManagerBuilder when PerformThinLTO=true (we are in the ThinLTO
backend), so that the newly imported functions are considered for
promotion in the backends.

The IC promotion profiles refer to callees by GUID, which required
adding GUIDs to the per-module VST in bitcode (and assigning them
valueIds similar to how they are assigned valueIds in the combined
index).

Reviewers: mehdi_amini, xur

Subscribers: mehdi_amini, davidxl, llvm-commits

Differential Revision: http://reviews.llvm.org/D21932

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275707 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/ModuleSummaryIndex.h
lib/Analysis/ModuleSummaryAnalysis.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/Transforms/IPO/PassManagerBuilder.cpp
test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll [new file with mode: 0644]
test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll [new file with mode: 0644]