summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/IR/ModuleSummaryIndex.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/IR/ModuleSummaryIndex.h')
-rw-r--r--llvm/include/llvm/IR/ModuleSummaryIndex.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index a7b7560132d..6b866dbd9e9 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -168,6 +168,12 @@ public:
return static_cast<GlobalValue::LinkageTypes>(Flags.Linkage);
}
+ /// Sets the linkage to the value determined by global summary-based
+ /// optimization. Will be applied in the ThinLTO backends.
+ void setLinkage(GlobalValue::LinkageTypes Linkage) {
+ Flags.Linkage = Linkage;
+ }
+
/// Return true if this summary is for a GlobalValue that needs promotion
/// to be referenced from another module.
bool needsRenaming() const { return GlobalValue::isLocalLinkage(linkage()); }
@@ -446,6 +452,13 @@ public:
return NewName.str();
}
+ /// Helper to obtain the unpromoted name for a global value (or the original
+ /// name if not promoted).
+ static StringRef getOriginalNameBeforePromote(StringRef Name) {
+ std::pair<StringRef, StringRef> Pair = Name.split(".llvm.");
+ return Pair.first;
+ }
+
/// Add a new module path with the given \p Hash, mapped to the given \p
/// ModID, and return an iterator to the entry in the index.
ModulePathStringTableTy::iterator
OpenPOWER on IntegriCloud