summaryrefslogtreecommitdiff
path: root/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2016-12-16 16:48:46 +0000
committerDehao Chen <dehao@google.com>2016-12-16 16:48:46 +0000
commit7e4360079c8a8212bf7a4e24916a91a601d5e46f (patch)
tree30a59d929cecbd1a48cbb21d52dc4e89ed3f7c03 /lib/LTO/LTO.cpp
parent1c91fb4936aab5a7b096b606ad97e3a5c39b6e6d (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289957 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO/LTO.cpp')
-rw-r--r--lib/LTO/LTO.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp
index 74de6c18aef..09198591da9 100644
--- a/lib/LTO/LTO.cpp
+++ b/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());
}