diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-07-18 18:31:50 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-07-18 18:31:50 +0000 |
commit | bb5c404e9a1ff80d4f14e10049183b65d69d3c44 (patch) | |
tree | 69e53875a9fe85a8974af7f5a8ef2eecdd7042dc /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 918f05063c5e32fe9c468ef569bf0ea9b1a81c22 (diff) | |
download | llvm-bb5c404e9a1ff80d4f14e10049183b65d69d3c44.zip llvm-bb5c404e9a1ff80d4f14e10049183b65d69d3c44.tar.gz llvm-bb5c404e9a1ff80d4f14e10049183b65d69d3c44.tar.bz2 |
[ThinLTO] Address review comments from PGO indirect call promotion (NFC)
Address a couple of post-commit review comments from r275707.
llvm-svn: 275867
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index dcb8b58..dce175b 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -147,18 +147,19 @@ public: // The starting ValueId is just after the number of values in the // ValueEnumerator, so that they can be emitted in the VST. GlobalValueId = VE.getValues().size(); - if (Index) - for (const auto &GUIDSummaryLists : *Index) - // Examine all summaries for this GUID. - for (auto &Summary : GUIDSummaryLists.second) - if (auto FS = dyn_cast<FunctionSummary>(Summary.get())) - // For each call in the function summary, see if the call - // is to a GUID (which means it is for an indirect call, - // otherwise we would have a Value for it). If so, synthesize - // a value id. - for (auto &CallEdge : FS->calls()) - if (CallEdge.first.isGUID()) - assignValueId(CallEdge.first.getGUID()); + if (!Index) + return; + for (const auto &GUIDSummaryLists : *Index) + // Examine all summaries for this GUID. + for (auto &Summary : GUIDSummaryLists.second) + if (auto FS = dyn_cast<FunctionSummary>(Summary.get())) + // For each call in the function summary, see if the call + // is to a GUID (which means it is for an indirect call, + // otherwise we would have a Value for it). If so, synthesize + // a value id. + for (auto &CallEdge : FS->calls()) + if (CallEdge.first.isGUID()) + assignValueId(CallEdge.first.getGUID()); } private: @@ -293,7 +294,10 @@ private: } unsigned getValueId(GlobalValue::GUID ValGUID) { const auto &VMI = GUIDToValueIdMap.find(ValGUID); - assert(VMI != GUIDToValueIdMap.end()); + // Expect that any GUID value had a value Id assigned by an + // earlier call to assignValueId. + assert(VMI != GUIDToValueIdMap.end() && + "GUID does not have assigned value Id"); return VMI->second; } // Helper to get the valueId for the type of value recorded in VI. |