summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/IR/GlobalValue.h15
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp2
2 files changed, 5 insertions, 12 deletions
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index 503023809e3..8fc34eced0e 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -114,19 +114,12 @@ private:
case AppendingLinkage:
case InternalLinkage:
case PrivateLinkage:
- return mayBeOverridden();
+ return isInterposable();
}
llvm_unreachable("Fully covered switch above!");
}
- /// Whether the definition of this global may be replaced by something
- /// non-equivalent at link time. For example, if a function has weak linkage
- /// then the code defining it may be replaced by different code.
- bool mayBeOverridden() const {
- return isMayBeOverriddenLinkage(getLinkage());
- }
-
protected:
/// \brief The intrinsic ID for this subclass (which must be a Function).
///
@@ -269,7 +262,7 @@ public:
/// Whether the definition of this global may be replaced by something
/// non-equivalent at link time. For example, if a function has weak linkage
/// then the code defining it may be replaced by different code.
- static bool isMayBeOverriddenLinkage(LinkageTypes Linkage) {
+ static bool isInterposableLinkage(LinkageTypes Linkage) {
switch (Linkage) {
case WeakAnyLinkage:
case LinkOnceAnyLinkage:
@@ -300,7 +293,7 @@ public:
/// Whether the definition of this global may be replaced at link time. NB:
/// Using this method outside of the code generators is almost always a
- /// mistake: when working at the IR level use mayBeOverridden instead as it
+ /// mistake: when working at the IR level use isInterposable instead as it
/// knows about ODR semantics.
static bool isWeakForLinker(LinkageTypes Linkage) {
return Linkage == WeakAnyLinkage || Linkage == WeakODRLinkage ||
@@ -352,7 +345,7 @@ public:
/// *arbitrary* definition at link time. We cannot do any IPO or inlinining
/// across interposable call edges, since the callee can be replaced with
/// something arbitrary at link time.
- bool isInterposable() const { return mayBeOverridden(); }
+ bool isInterposable() const { return isInterposableLinkage(getLinkage()); }
bool hasExternalLinkage() const { return isExternalLinkage(getLinkage()); }
bool hasAvailableExternallyLinkage() const {
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 3ce3b7b841e..498ce5e3fb4 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -156,7 +156,7 @@ selectCallee(const ModuleSummaryIndex &Index,
CalleeSummaryList,
[&](const std::unique_ptr<GlobalValueSummary> &SummaryPtr) {
auto *GVSummary = SummaryPtr.get();
- if (GlobalValue::isMayBeOverriddenLinkage(GVSummary->linkage()))
+ if (GlobalValue::isInterposableLinkage(GVSummary->linkage()))
// There is no point in importing these, we can't inline them
return false;
if (auto *AS = dyn_cast<AliasSummary>(GVSummary)) {
OpenPOWER on IntegriCloud