From dda958783ec9da91753fc483b461da7a8a83c538 Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Wed, 16 Aug 2017 17:33:43 +0000 Subject: Add more comment git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311025 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/Bitcode') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index e3b43b333a1..c81e2006ad8 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3627,7 +3627,15 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { if (!CallValueId) continue; // The mapping from OriginalId to GUID may return a GUID - // that corresponds to a static varible. Filter it out here. + // that corresponds to a static variable. Filter it out here. + // This can happen when + // 1) There is a call to a library function which does not have + // a CallValidId; + // 2) There is a static variable with the OriginalGUID identical + // to the GUID of the library function in 1); + // When this happens, the logic for SamplePGO kicks in and + // the static varible in 2) will be found, which needs to be + // filtered out. auto *GVSum = Index.getGlobalValueSummary(GUID, false); if (GVSum && GVSum->getSummaryKind() == GlobalValueSummary::GlobalVarKind) -- cgit v1.2.3