Index: include/llvm/IR/GlobalValue.h =================================================================== --- include/llvm/IR/GlobalValue.h +++ include/llvm/IR/GlobalValue.h @@ -114,19 +114,12 @@ 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 @@ /// 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 @@ /// 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 @@ /// *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 { Index: lib/Transforms/IPO/FunctionImport.cpp =================================================================== --- lib/Transforms/IPO/FunctionImport.cpp +++ lib/Transforms/IPO/FunctionImport.cpp @@ -156,7 +156,7 @@ CalleeSummaryList, [&](const std::unique_ptr &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(GVSummary)) {