diff options
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/IR/ModuleSummaryIndex.h | 18 | ||||
-rw-r--r-- | llvm/include/llvm/IR/Value.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/Transforms/IPO/FunctionImport.h | 9 |
3 files changed, 30 insertions, 1 deletions
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h index b1e58a2a0d9..dd7a0db8377 100644 --- a/llvm/include/llvm/IR/ModuleSummaryIndex.h +++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h @@ -246,6 +246,7 @@ public: /// If this is an alias summary, returns the summary of the aliased object (a /// global variable or function), otherwise returns itself. GlobalValueSummary *getBaseObject(); + const GlobalValueSummary *getBaseObject() const; friend class ModuleSummaryIndex; friend void computeDeadSymbols(class ModuleSummaryIndex &, @@ -255,10 +256,14 @@ public: /// \brief Alias summary information. class AliasSummary : public GlobalValueSummary { GlobalValueSummary *AliaseeSummary; + // AliaseeGUID is only set and accessed when we are building a combined index + // via the BitcodeReader. + GlobalValue::GUID AliaseeGUID; public: AliasSummary(GVFlags Flags) - : GlobalValueSummary(AliasKind, Flags, ArrayRef<ValueInfo>{}) {} + : GlobalValueSummary(AliasKind, Flags, ArrayRef<ValueInfo>{}), + AliaseeSummary(nullptr), AliaseeGUID(0) {} /// Check if this is an alias summary. static bool classof(const GlobalValueSummary *GVS) { @@ -266,6 +271,7 @@ public: } void setAliasee(GlobalValueSummary *Aliasee) { AliaseeSummary = Aliasee; } + void setAliaseeGUID(GlobalValue::GUID GUID) { AliaseeGUID = GUID; } const GlobalValueSummary &getAliasee() const { assert(AliaseeSummary && "Unexpected missing aliasee summary"); @@ -276,8 +282,18 @@ public: return const_cast<GlobalValueSummary &>( static_cast<const AliasSummary *>(this)->getAliasee()); } + const GlobalValue::GUID &getAliaseeGUID() const { + assert(AliaseeGUID && "Unexpected missing aliasee GUID"); + return AliaseeGUID; + } }; +const inline GlobalValueSummary *GlobalValueSummary::getBaseObject() const { + if (auto *AS = dyn_cast<AliasSummary>(this)) + return &AS->getAliasee(); + return this; +} + inline GlobalValueSummary *GlobalValueSummary::getBaseObject() { if (auto *AS = dyn_cast<AliasSummary>(this)) return &AS->getAliasee(); diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h index 12a4877320b..f3bcba0a03f 100644 --- a/llvm/include/llvm/IR/Value.h +++ b/llvm/include/llvm/IR/Value.h @@ -330,6 +330,10 @@ public: return UseList == nullptr; } + bool materialized_use_empty() const { + return UseList == nullptr; + } + using use_iterator = use_iterator_impl<Use>; using const_use_iterator = use_iterator_impl<const Use>; diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/llvm/include/llvm/Transforms/IPO/FunctionImport.h index 63c73af44e8..39e5b5c8ae6 100644 --- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h +++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h @@ -98,6 +98,15 @@ void ComputeCrossModuleImportForModule( StringRef ModulePath, const ModuleSummaryIndex &Index, FunctionImporter::ImportMapTy &ImportList); +/// Mark all external summaries in \p Index for import into the given module. +/// Used for distributed builds using a distributed index. +/// +/// \p ImportList will be populated with a map that can be passed to +/// FunctionImporter::importFunctions() above (see description there). +void ComputeCrossModuleImportForModuleFromIndex( + StringRef ModulePath, const ModuleSummaryIndex &Index, + FunctionImporter::ImportMapTy &ImportList); + /// Compute all the symbols that are "dead": i.e these that can't be reached /// in the graph from any of the given symbols listed in /// \p GUIDPreservedSymbols. |