[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)
commitcd21a646f656c18bc71bb2ef789ff34ce8f2557c
tree925cccde836abec164a8a04d7717cb2db6ba6a25
parentce7de9b6fba73a938c80d6dbb737c48be6e8f7dc
[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

llvm-svn: 275707
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll [new file with mode: 0644]
llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll [new file with mode: 0644]