diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h index db290923dcf0..04352193ec43 100644 --- a/llvm/include/llvm/IR/GlobalValue.h +++ b/llvm/include/llvm/IR/GlobalValue.h @@ -198,7 +198,9 @@ public: GlobalValue(const GlobalValue &) = delete; - unsigned getAddressSpace() const; + unsigned getAddressSpace() const { + return getType()->getAddressSpace(); + } enum class UnnamedAddr { None, diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 684cff831068..7880369a2f98 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -118,11 +118,6 @@ bool GlobalValue::canBenefitFromLocalAlias() const { !isa(this) && !isDeduplicateComdat(getComdat()); } -unsigned GlobalValue::getAddressSpace() const { - PointerType *PtrTy = getType(); - return PtrTy->getAddressSpace(); -} - void GlobalObject::setAlignment(MaybeAlign Align) { assert((!Align || *Align <= MaximumAlignment) && "Alignment is greater than MaximumAlignment!");