diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-03-15 19:35:45 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-03-15 19:35:45 +0000 |
commit | 1396809b17f330e7bd1ff528bcd529796ddb207b (patch) | |
tree | 59afd65420362d2f1bad53c0adb3a45a2370dc78 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 9b4bbeabcccf37172c64432ad9828a42e47501e0 (diff) | |
download | llvm-1396809b17f330e7bd1ff528bcd529796ddb207b.zip llvm-1396809b17f330e7bd1ff528bcd529796ddb207b.tar.gz llvm-1396809b17f330e7bd1ff528bcd529796ddb207b.tar.bz2 |
[ThinLTO] Record all global variable defs in the summary
Record all variable defs with a summary record to aid in building a
complete reference graph and locating constant variable defs to import.
llvm-svn: 263576
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index ccffb31..6510bce 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -2900,20 +2900,20 @@ static void WriteModuleLevelReferences(const GlobalVariable &V, SmallVector<uint64_t, 64> &NameVals, unsigned FSModRefsAbbrev, BitstreamWriter &Stream) { + // Only interested in recording variable defs in the summary. + if (V.isDeclaration()) + return; DenseSet<unsigned> RefEdges; SmallPtrSet<const User *, 8> Visited; findRefEdges(&V, VE, RefEdges, Visited); - unsigned RefCount = RefEdges.size(); - if (RefCount) { - NameVals.push_back(VE.getValueID(&V)); - NameVals.push_back(getEncodedLinkage(V.getLinkage())); - for (auto RefId : RefEdges) { - NameVals.push_back(RefId); - } - Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals, - FSModRefsAbbrev); - NameVals.clear(); + NameVals.push_back(VE.getValueID(&V)); + NameVals.push_back(getEncodedLinkage(V.getLinkage())); + for (auto RefId : RefEdges) { + NameVals.push_back(RefId); } + Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals, + FSModRefsAbbrev); + NameVals.clear(); } /// Emit the per-module summary section alongside the rest of @@ -3054,7 +3054,6 @@ static void WriteCombinedGlobalValueSummary( assert(S); if (auto *VS = dyn_cast<GlobalVarSummary>(S)) { - assert(!VS->refs().empty() && "Expected at least one ref edge"); NameVals.push_back(I.getModuleId(VS->modulePath())); NameVals.push_back(getEncodedLinkage(VS->linkage())); for (auto &RI : VS->refs()) { |