From 4e0ca5ef00cf63df7bbe22d679cbf3d8009976e6 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 28 Nov 2022 15:06:09 -0500 Subject: [PATCH] GlobalValue: Move trivial getAddressSpace getter to header --- llvm/include/llvm/IR/GlobalValue.h | 4 +++- llvm/lib/IR/Globals.cpp | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) 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!");