diff options
author | Dehao Chen <dehao@google.com> | 2016-12-16 16:48:46 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2016-12-16 16:48:46 +0000 |
commit | 27978005955754bf11b71766c08b768e9fb5c040 (patch) | |
tree | 7ee54ef41a986925931598c40509827b21846d19 /llvm/lib/LTO/LTO.cpp | |
parent | c3d0165c494a6323a8e293cf1b3b3e46764be095 (diff) | |
download | bcm5719-llvm-27978005955754bf11b71766c08b768e9fb5c040.tar.gz bcm5719-llvm-27978005955754bf11b71766c08b768e9fb5c040.zip |
Pass sample pgo flags to thinlto.
Summary: ThinLTO needs to invoke SampleProfileLoader pass during link time in order to annotate profile correctly after module importing.
Reviewers: davidxl, mehdi_amini, tejohnson
Subscribers: pcc, davide, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D27790
llvm-svn: 289957
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 74de6c18aef..09198591da9 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -129,6 +129,12 @@ static void computeCacheKey( ArrayRef<uint8_t>((const uint8_t *)&Linkage, sizeof(Linkage))); } + if (!Conf.SampleProfile.empty()) { + auto FileOrErr = MemoryBuffer::getFile(Conf.SampleProfile); + if (FileOrErr) + Hasher.update(FileOrErr.get()->getBuffer()); + } + Key = toHex(Hasher.result()); } |