[PGO] Comment how function pointers for indirect calls are mapped to function names

Summary:
Hopefully this will make it easier for the next person to figure all
this out...

Reviewers: bogner, davidxl

Subscribers: llvm-commits

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

llvm-svn: 264611
This commit is contained in:
Adam Nemet 2016-03-28 18:27:44 +00:00
parent e9f15b4b9f
commit 2f36f05951
2 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,8 @@ INSTR_PROF_DATA(const uint64_t, llvm::Type::getInt64Ty(Ctx), FuncHash, \
INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt64PtrTy(Ctx), CounterPtr, \
ConstantExpr::getBitCast(CounterPtr, \
llvm::Type::getInt64PtrTy(Ctx)))
// This is used to map function pointers for the indirect call targets to
// function name hashes during the conversion from raw to merged profile data.
INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), FunctionPointer, \
FunctionAddr)
INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \

View File

@ -412,6 +412,9 @@ RawInstrProfReader<IntPtrT>::readValueProfilingData(InstrProfRecord &Record) {
if (VDataPtrOrErr.getError())
return VDataPtrOrErr.getError();
// Note that besides deserialization, this also performs the conversion for
// indirect call targets. The function pointers from the raw profile are
// remapped into function name hashes.
VDataPtrOrErr.get()->deserializeTo(Record, &Symtab->getAddrHashMap());
CurValueDataSize = VDataPtrOrErr.get()->getSize();
return success();