summaryrefslogtreecommitdiff
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2017-08-16 17:18:01 +0000
committerXinliang David Li <davidxl@google.com>2017-08-16 17:18:01 +0000
commit2f4468d845f9ca4ced09c5afccf7d9033fd3e727 (patch)
tree5fae7c214105405d98bd86f9b2ce9317770ad0ae /lib/Bitcode
parentcb139f4145041b4eb76e7941416a623a19305aba (diff)
[PGO] Fix ThinLTO crash
Differential Revsion: http://reviews.llvm.org/D36640 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index fc58718df1f..e3b43b333a1 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -3626,6 +3626,12 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
CallValueId = getValueId(GUID);
if (!CallValueId)
continue;
+ // The mapping from OriginalId to GUID may return a GUID
+ // that corresponds to a static varible. Filter it out here.
+ auto *GVSum = Index.getGlobalValueSummary(GUID, false);
+ if (GVSum &&
+ GVSum->getSummaryKind() == GlobalValueSummary::GlobalVarKind)
+ continue;
}
NameVals.push_back(*CallValueId);
if (HasProfileData)