[PATCH] D35081: [ThinLTO] Allow multiple summary entries.
Florian Hahn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 6 12:41:39 PDT 2017
fhahn created this revision.
Herald added a subscriber: inglorion.
When combining modules with entries that allow multiple definitions,
the combined index can contain multiple summaries for a single GUID.
Unless I miss something here, we should be able to continue by just
picking the first summary, if all entries in the list allow
multiple definitions.
I am not sure if we should relax the assertion here or select a single
summary when building the index?
https://reviews.llvm.org/D35081
Files:
lib/CodeGen/BackendUtil.cpp
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -56,6 +56,7 @@
#include "llvm/Transforms/Scalar/GVN.h"
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
#include "llvm/Transforms/Utils/SymbolRewriter.h"
+#include <algorithm>
#include <memory>
using namespace clang;
using namespace llvm;
@@ -1014,8 +1015,18 @@
continue;
auto GUID = GlobalList.first;
- assert(GlobalList.second.SummaryList.size() == 1 &&
- "Expected individual combined index to have one summary per GUID");
+ auto &SummaryList = GlobalList.second.SummaryList;
+ auto MultipleDefPred = [](std::unique_ptr<llvm::GlobalValueSummary> &S) {
+ auto Linkage = S->linkage();
+ return GlobalValue::isAvailableExternallyLinkage(Linkage) ||
+ GlobalValue::isLinkOnceODRLinkage(Linkage) ||
+ GlobalValue::isWeakODRLinkage(Linkage);
+ };
+ assert((SummaryList.size() == 1 || (SummaryList.size() > 1 &&
+ std::all_of(SummaryList.begin(), SummaryList.end(),
+ MultipleDefPred))) &&
+ "Expected individual combined index to have one summary per GUID or "
+ "multiple entries if the allow multiple definitions.");
auto &Summary = GlobalList.second.SummaryList[0];
// Skip the summaries for the importing module. These are included to
// e.g. record required linkage changes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35081.105511.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170706/98166a26/attachment.bin>
More information about the cfe-commits
mailing list