[ThinLTO] Indirect call promotion fixes for promoted local functions
authorTeresa Johnson <tejohnson@google.com>
Mon, 29 Aug 2016 22:46:56 +0000 (22:46 +0000)
committerTeresa Johnson <tejohnson@google.com>
Mon, 29 Aug 2016 22:46:56 +0000 (22:46 +0000)
commit8c1bc986b598fd352262c53e6e36307d02036d3c
treef3f891c88de04d62081060fbb452ea37c04f56bb
parentfafcb85e7964ce28c7a2bf38f6ba864fbfa6c0b6
[ThinLTO] Indirect call promotion fixes for promoted local functions

Summary:
Fix a couple issues limiting the application of indirect call promotion
in ThinLTO mode:
- Invoke indirect call promotion before globalopt, since it may
  eliminate imported functions which appear unreferenced.
- Invoke indirect call promotion with InLTO=true so that the PGOFuncName
  metadata is used to get the name for locals which would have been
  renamed during promotion.

Reviewers: davidxl, mehdi_amini

Subscribers: Prazek, llvm-commits, mehdi_amini

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

llvm-svn: 280024
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll
llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll